![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
操作系统
文章平均质量分 78
Kesperado
这个作者很懒,什么都没留下…
展开
-
PV操作之独木桥问题
一、东西向汽车过独木桥,为了保证安全,只要桥上无车,则允许一方的汽车过桥,待一方的汽车全部过完后,另一方的汽车才允许过桥。semaphore wait,mutex1,mutex2;mutex1=mutex2=1;wait=1; bridge=1;int counter1,counter2; counter1=0;counter2=0;semaphore S1,S2;S1=3;S2=0;pr转载 2014-06-23 14:00:06 · 42433 阅读 · 9 评论 -
PV操作经典问题
飞机票问题Var A : ARRAY[1..m] of integer; mutex : semaphore; mutex:= 1;cobeginprocess Pi var Xi:integer;begin L1: 按旅客定票要求找到A[j]; P(mutex); Xi := A[j]; if Xi>=1 then begin转载 2014-06-22 18:40:40 · 6107 阅读 · 2 评论 -
PV操作其他问题
一、飞机票问题Var A : ARRAY[1..m] of integer; mutex : semaphore; mutex:= 1;cobeginprocess Pi var Xi:integer;begin L1: 按旅客定票要求找到A[j]; P(mutex); Xi := A[j]; if Xi>=1 then begin转载 2014-06-23 13:06:30 · 4010 阅读 · 1 评论