看板 Grad-ProbAsk 關於我們 聯絡資訊
因為題目敘述有三個process執行 所以可以分成下面這種情況來討論 P1 P2 P3 ------------------------------ T1:x=y T2:x=y T3:x=y T4:x=x+1 T5:x=x+1 T6:x=x+1 T7 :y=x T8 :y=x T9 :y=x 若要y=2 則依照下面的順序執行即可 T1 T4 T7 T2 T3 T5 T6 T8 T9 有錯請指證! ※ 引述《wsx02 ()》之銘言: : shared y; : begin : local x; : x = y; : x = x+1; : y = x; : end : if local variable x and shared variable y initially 0 and three copies of the : process run concurrently. What is the possible values of y after three copies : of the process terminate? : y的可能值有2 : 請問是怎麼跑出來的? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.104.4
wsx02:x是local variable 我照這樣的順序出來y=1 可以請問細節嗎? 03/13 21:28
wsx02:我造出來了 03/13 21:29
wsx02:順序是T1 T2 T4 T5 T7 T8 T3 T6 T9 謝謝 03/13 21:30
噢 沒注意到是local 感謝指證! ※ 編輯: Fight5566 來自: 118.169.104.4 (03/13 21:34)