全文预览

操作系统实验指导书

上传者:你的雨天 |  格式:doc  |  页数:38 |  大小:0KB

文档介绍
}Р if(i<6) return;Р eexit(0);Р }Рprocess2()Р{Р if(addr=='a')goto a2;Р if(addr=='b')goto b2;Р if(addr=='c')goto c2;Р if(addr=='d')goto d2;Р if(addr=='e')goto e2;Р if(addr=='f')goto f2;Рfor(i=1;i<6;++i)Р{Р printf("process2 calls Pon semephore2\n");Р if(p(1,'a')) break;Рa2: printf("process2 is executing on the cretical section2\n");Р if(timeint('b')) break;Рb2: printf("s2=%d\n",++s2);Р printf("process2 calls V on semephore2 and quit cretical section2.\n");Р if(v(1,'c')) break;Рc2: printf("process2 calls P on semaphore1.\n");Р if(p(0,'d')) break;Рd2: printf("process2 is executing cretical section1.\n");Р if(timeint('e')) break;Рe2: printf("s1=%d\n",++s1);Р printf("process2 calls V on semephore1 and quit cretical section1.\n");Р if(v(0,'f')) break;Рf2: printf("process2 cycle count=%d\n",i);Р }

收藏

分享

举报
下载此文档