wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Ch06-Synchronization Tools_part01

Total questions: 9

Worksheet time: 9mins

Name
Class
Date
1.

Process有分independent processes 和 cooperation processes,請問那一種會發生race condition?

a)

independent processes

b)

cooperation processes

2.

cooperation processes發生race condition,主要原因是(複選)

a)

processes的執行順序無法確定

b)

優先權低的process永遠搶不到資源

c)

processes共享記憶體變數

3.

造成cooperation processes執行順序無法確定的主要原因是?

a)

CPU number

b)

Interrupt

c)

Memory size

4.

為何我們不直接關閉interrupt 解決race condition? (複選)

a)

Interrupt無法關閉

b)

關閉interrupt方法,在多核心CPU下不適用

c)

關閉interrupt指令只能在Kernel mode執行,User 不能在程式直接呼叫

5.

下面哪一個不是硬體支援processes做同步的選項

a)

Peterson’s solution

b)

Hardware instructions

c)

Atomic variables

6.

Peterson’s solution 中有一個指令順序被編譯器重新排序,導致無法解決Race condition問題,請問可以用何種方式解決?

a)

Memory barriers

b)

Hardware instructions

c)

Atomic variables

7.

以下哪一個是屬於atomic hardware instructions(複選)

a)

memory barrier()

b)

test_and _ set()

c)

compare_and_swap()

8.

以下對於單元變數 (Atomic variables)描述,何者有錯?

a)

可以對變數進行atomic operation,即存取變數過程不被中斷,以達到互斥

b)

使用special functions 如 Increment ( )

c)

可以透過memory barrier實踐

9.

以下哪一種同步工具可以滿足解決CS的3個條件

a)

Peterson’s solution

b)

Memory barriers

c)

Hardware instructions