[理工] [OS]-政大

看板Grad-ProbAsk作者 (MrEric)時間16年前 (2010/03/03 18:25), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
Give the follwing variables and their initial values as follows: X:integer,initial value is 0 y:integer,initial value is 23 m:general semaphore,initial value is 1 m1:general semaphore,initial value is 0 For each of the following program,list values possible for x when the program terminates. Note that"cobegin P1||P2 ;coend" means P1 and P2 are executed concurrently, and ":=" is the assignment operator. (1)cobegin P(m1);x:=x+1;V(m) || P(m);x=y+1;V(m1) coend (2)cobegin V(m1);x:=x+1;P(m) || V(m1);x:=y+1;P(m1); coend 答案(1) 25 (2) 1,24 or 25 我想請問一下P(m1) V(m1) P(m) V(m)是什麼意思呢? 另外(2)的結果是怎麼推算出來的 謝謝各位指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.41.112.218 ※ 編輯: bigrat2 來自: 114.41.112.218 (03/03 18:26)

03/03 18:29, , 1F
P(),V()就是Semaphore的wait(),signal()
03/03 18:29, 1F
文章代碼(AID): #1BZZaUHT (Grad-ProbAsk)
討論串 (同標題文章)
以下文章回應了本文
完整討論串 (本文為第 1 之 2 篇):
理工
0
1
文章代碼(AID): #1BZZaUHT (Grad-ProbAsk)