[理工] OS 106交大資聯 test-and-set
題目:
Which one(s) of the following statements adequately describe the test-and-set instruction for process synchronization?
(A) It does not work in multiprocessor environment.
(B) It can all be implemented in the user space, provided that the lock variable is in a shared memory region
(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 operation.
答案: (B)(D)
請問
A選項: 書上說在multiprocessor系統下用test-and-set效能差, 這個選項錯是因為"只是效能差, 不代表不能用"嗎?
B選項: 硬體的support, 不是要在kernel mode下才能運作嗎? 還是我觀念有誤?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.255.72.148
※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1510845618.A.FBC.html
※ 編輯: clonsey1314 (111.255.72.148), 11/16/2017 23:21:03
→
11/16 23:35,
6年前
, 1F
11/16 23:35, 1F
推
11/17 00:46,
6年前
, 2F
11/17 00:46, 2F
→
11/17 00:46,
6年前
, 3F
11/17 00:46, 3F
推
11/17 00:48,
6年前
, 4F
11/17 00:48, 4F
→
11/17 00:48,
6年前
, 5F
11/17 00:48, 5F
→
11/17 00:49,
6年前
, 6F
11/17 00:49, 6F
→
11/17 00:49,
6年前
, 7F
11/17 00:49, 7F
謝謝J大和s大! 有再把hardware protection的地方再重翻一遍!
再請問一下s大:A的部分, 如果不能work指的是critical section的3大條件, 那test-and-set不是不符合"bounded waiting"嗎?
※ 編輯: clonsey1314 (111.255.66.36), 11/17/2017 01:06:05
※ 編輯: clonsey1314 (111.255.66.36), 11/17/2017 01:06:46
→
11/17 01:19,
6年前
, 8F
11/17 01:19, 8F
→
11/17 01:20,
6年前
, 9F
11/17 01:20, 9F
推
11/17 01:30,
6年前
, 10F
11/17 01:30, 10F
→
11/17 01:31,
6年前
, 11F
11/17 01:31, 11F
→
11/17 01:34,
6年前
, 12F
11/17 01:34, 12F
→
11/17 01:36,
6年前
, 13F
11/17 01:36, 13F
→
11/17 08:02,
6年前
, 14F
11/17 08:02, 14F
→
11/17 08:03,
6年前
, 15F
11/17 08:03, 15F
→
11/17 08:03,
6年前
, 16F
11/17 08:03, 16F
→
11/17 22:50,
6年前
, 17F
11/17 22:50, 17F
推
11/22 18:46,
6年前
, 18F
11/22 18:46, 18F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):