[理工] OS process synchronization
consider the following program
boolean block[2];
int turn;
void p(int id){
while(true)
blocked[id]=true;
while(trun!=id){
while(blocked[1-id]) do noop;
turn = id;
}
/*critical section*/
block[id] = false;
/*remainder section*/
}
}
void main()
{
blocked[0]=false;
blocked[1]=false;
turn = 0;
parbegin(p(0),p(1));
}
is mutual exclusion satisfied?!
我想問的是parbegin是什麼意思?!
是說直接從程式的某個部分開始跑嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.77.45.92
→
11/29 00:51, , 1F
11/29 00:51, 1F
→
11/29 00:51, , 2F
11/29 00:51, 2F
→
11/29 00:52, , 3F
11/29 00:52, 3F
→
11/29 14:26, , 4F
11/29 14:26, 4F
→
11/29 22:20, , 5F
11/29 22:20, 5F
→
11/29 22:22, , 6F
11/29 22:22, 6F
→
11/29 22:23, , 7F
11/29 22:23, 7F
推
11/29 22:54, , 8F
11/29 22:54, 8F
推
11/29 22:57, , 9F
11/29 22:57, 9F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):