作者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://webptt.com/cn.aspx?n=bbs/Grad-ProbAsk/M.1516890721.A.B5B.html
※ 编辑: EriXchu (59.120.251.134), 01/25/2018 22:32:56
1F:推 djmez: 提供单一组语指令就可以完成动作 01/25 23:48
2F:→ TMDTMD2487: 你这问题就像是在问cpu怎麽执行一个Rtype指令一样XD 01/26 01:28
3F:→ TMDTMD2487: 就是一个大小判断+写入mem datapath画出来就设计好了 01/26 01:34
4F:→ TMDTMD2487: 补一个小错误不是大小判断T&S就写return value跟mem 01/26 01:49