Re: [理工] OS 106交大資聯 test-and-set

作者: EriXchu (耍廢艾瑞克)   2018-01-25 22:31:59
請問一下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下才能運作嗎? 還是我觀念有誤?
作者: djmez   2018-01-25 23:48:00
提供單一組語指令就可以完成動作
作者: TMDTMD2487 (ㄚ冰)   2018-01-26 01:28:00
你這問題就像是在問cpu怎麼執行一個Rtype指令一樣XD就是一個大小判斷+寫入mem datapath畫出來就設計好了補一個小錯誤不是大小判斷T&S就寫return value跟mem

Links booklink

Contact Us: admin [ a t ] ucptt.com