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