好文档 - 专业文书写作范文服务资料分享网站

操作系统预习报告1 

天下 分享 时间: 加入收藏 我要投稿 点赞

内蒙古工业大学数据科学与应用学院

sprintf(pint,\msg.mtype=1000000;

msgsnd(msgqid,&msg,256,0); msgrcv(msgqid,&msg,256,pid,0); printf(\return 0; }

(2)服务器程序设计 #include #include #include #define MSGKEY 75 struct msgform{

long mtype; char mtext[256]; }msg; int msgqid; void cleanup(); int main(){

int i,pid;

for(i=0;i<20;i++)

signal(i,cleanup);

int msgqid=msgget(MSGKEY,0777|IPC_CREAT);

pid=getpid();

printf(\

for(;;){

msgrcv(msgqid,&msg,256,1000000,0);

char*pint=msg.mtext;

printf(\ msg.mtype=atoi(msg.mtype);

*pint=pid;

printf(\sprintf(pint,\

第 页

内蒙古工业大学数据科学与应用学院

msgsnd(msgqid,&msg,256,0); }

void cleanup(){

}

msgctl(msgqid,IPC_RMID,0); exit(0);

}

return 0;

实验预期输出 1、进程的软中断通信【举例1】 Parent run! P1=4699 P2=4700 P2 run! Waiting begin! P1 run! Waiting begin! Signal stop! Waiting end! Child process 1 is killed by parent! Signal stop! Waiting end! Child process 2 is killed by parent! Parent process 2 is killed by parent! Parent process is killed! 1、进程的软中断通信【举例2】 Parent run! Process 2 run! Process 1 run! 2、进程的管道通信 Parent run! P1 run! P2 run! Child 2 process is sending a message! 3、进程的消息队列通信 Client:receive from pid2819 Server:receive from pid 32766 Server:receive from pid 32766 第 页

内蒙古工业大学数据科学与应用学院 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 Server:receive from pid 32766 ......

第 页

操作系统预习报告1 

内蒙古工业大学数据科学与应用学院sprintf(pint,\msg.mtype=1000000;msgsnd(msgqid,&msg,256,0);msgrcv(msgqid,&msg,256,pid,0);printf(\return0;}(2)服务器程序设计#include#
推荐度:
点击下载文档文档为doc格式
6y98a6hush6u75f0b3w102ra61x6wi01dgt
领取福利

微信扫码领取福利

微信扫码分享