作者EriXchu (瘦瘦肥宅艾瑞克)
看板Grad-ProbAsk
標題Re: [理工] OS 106交大資聯 test-and-set
時間Thu Jan 25 22:31:59 2018
請問一下d選項的“CPU must guarantee…”
cpu是怎麼保證atomically executed呢?
我知道計組也有談到互斥存取這部分
但不太了解是怎麼或是有什麼元件達到的
※ 引述《clonsey1314 (Clonsey)》之銘言:
: 題目:
: Which one(s) of the following statements adequately describe the test-and-se
t
: (A) It does not work in multiprocessor environment.
: (B) It can all be implemented in the user space, provided that the lock vari
ab
: (C) It does not waste any CPU cycles when a process cannot acquire a lock
: (D) The CPU must guarantee that the test-and-set instruction is an atomic op
er
: 答案: (B)(D)
: 請問
: A選項: 書上說在multiprocessor系統下用test-and-set效能差, 這個選項錯是因為"只
是
: B選項: 硬體的support, 不是要在kernel mode下才能運作嗎? 還是我觀念有誤?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.120.251.134
※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1516890721.A.B5B.html
※ 編輯: EriXchu (59.120.251.134), 01/25/2018 22:32:56
推 djmez: 提供單一組語指令就可以完成動作 01/25 23:48
→ TMDTMD2487: 你這問題就像是在問cpu怎麼執行一個Rtype指令一樣XD 01/26 01:28
→ TMDTMD2487: 就是一個大小判斷+寫入mem datapath畫出來就設計好了 01/26 01:34
→ TMDTMD2487: 補一個小錯誤不是大小判斷T&S就寫return value跟mem 01/26 01:49