
[理工] OS 同步


我想請問這裡用Semaphore來製作Monitor,考試Code是只要寫x.wait跟x.signal還是上面的那個也要寫
還有想問這裡的mutex,互斥是在控制什麼,為什麼x-count跟next-count不用做互斥控制,是因為就只有P會用到next-count, Q不會用到的關係嗎
-----
Sent from JPTT on my Samsung SM-A730F.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.76.4.115 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1567311393.A.ED6.html
→
09/01 22:04,
6年前
, 1F
09/01 22:04, 1F
→
09/01 22:04,
6年前
, 2F
09/01 22:04, 2F
→
09/01 22:11,
6年前
, 3F
09/01 22:11, 3F
→
09/01 22:13,
6年前
, 4F
09/01 22:13, 4F
所以考試出用semaphore做Monitor就只需要寫最上面的code囉?
可是Monitor不是本來就有保證互斥了,為什麼還要特別用mutex來做互斥存取
※ 編輯: shinle14 (42.76.4.115 臺灣), 09/01/2019 22:21:45
→
09/01 22:26,
6年前
, 5F
09/01 22:26, 5F
→
09/01 22:26,
6年前
, 6F
09/01 22:26, 6F
→
09/01 22:27,
6年前
, 7F
09/01 22:27, 7F
→
09/01 22:27,
6年前
, 8F
09/01 22:27, 8F