[理工] 計系 104清大 semaphore

看板Grad-ProbAsk作者 (monster710623)時間6年前 (2019/12/30 21:15), 6年前編輯推噓1(109)
留言10則, 3人參與, 6年前最新討論串1/1
https://i.imgur.com/WaBoVcN.jpg
請問這題再問啥啊 有看沒懂? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.120.220.5 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1577711702.A.06A.html

12/30 21:26, 6年前 , 1F
三種情況個可能發生什麼事
12/30 21:26, 1F

12/30 21:26, 6年前 , 2F
*各
12/30 21:26, 2F

12/30 21:37, 6年前 , 3F
忽略不同semaphore 會發生什麼事
12/30 21:37, 3F
所以答案應該是 “While” is violated or a “busy waiting” will occur 是這樣嗎 ※ 編輯: ching4562 (110.50.187.159 臺灣), 12/30/2019 22:19:40

12/30 23:36, 6年前 , 4F
初值是1 如果某個是對的會有什麼問題 s1:signal mutex看起來
12/30 23:36, 4F

12/30 23:36, 6年前 , 5F
會有mutual exclusion或race condition(mutex應該不超過1)
12/30 23:36, 5F

12/30 23:36, 6年前 , 6F
同樣的問題s3也會有 s2只有wait但沒signal會有deadlock
12/30 23:36, 6F

12/30 23:37, 6年前 , 7F
唯一沒問題的情況就 wait 然後 signal
12/30 23:37, 7F

12/30 23:40, 6年前 , 8F
應該是violate mutual exclusion or deadlock will occur
12/30 23:40, 8F

12/30 23:41, 6年前 , 9F
I就s1 s3 II就s2
12/30 23:41, 9F
感恩 多謝幫忙 ※ 編輯: ching4562 (140.120.220.3 臺灣), 12/31/2019 19:37:27

02/05 09:54, 6年前 , 10F
deadlock可能寫progress會比較好
02/05 09:54, 10F
文章代碼(AID): #1U2VXM1g (Grad-ProbAsk)