Silent Member
|
[考題]求救...研究所(作業系統)考題..請各位幫幫忙
小弟這個問題...已經PO在奇摩知識快1個月了...
都沒人回應..希望站上有高手可以幫忙...
題目如下: Find a counterexample that demonstrates that this solution is incorrect
(請找出下列程式中的錯誤)
Concider the following program:
1 bollean block[2];
2 in turn;
3 void P(int id){
4 while(true){
5 blocked[id]=true;
6 while(turn!=id){
7 while(Blocked[1-id])
8 ;
9 turn=id;
10 }
11 /* critical section*/
12 blocked[id]=false;
13 /* remainder*/
14 }
15 }
16 void manin(){
17 blocked[0]false;
18 blocked[1]false;
19 turn=0;
20 parbegin(P(0),P(1));
21 }
這邊沒點數可給...只能先給各位高手說聲謝謝!!
|