Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Ch06-Synchronization Tools_part2

Total questions: 9

Worksheet time: 7mins

Name
Class
Date
1.

下列哪一個是OS提供的同步工具?(複選)

a)

memory barrier

b)

mutex lock

c)

semaphore

2.

mutex lock 使用哪2個atomic function處理boolean variable?(複選)

a)

wait ( )

b)

acquire ( )

c)

release ( )

d)

signal ( )

3.

以下對於busy waiting描述何者有誤?

a)

process未能進入CS,只能不斷呼叫acquire( )或wait(),等待進入CS

b)

搶不到CPU資源

c)

執行過程是在浪費CPU資源

4.

以下哪一個同步方法可以解決Busy waiting 問題?

a)

memory barrier

b)

semaphore

c)

peterson's solution

5.

以下哪一個對spinlock描述有誤?

a)

是一種mutex lock

b)

不須做context switch

c)

沒有 busy waiting 問題

6.

semaphore使用哪2個atomic function處理boolean variable?(複選)

a)

wait ( )

b)

acquire ( )

c)

release ( )

d)

signal ( )

7.

以下哪一個是semaphore的正確使用方法?

a)

wait (s);

critical section

signal (s);

b)

wait (s);

critical section

wait (s);

c)

signal (s);

critical section

wait (s);

d)

signal (s);

critical section

signal (s);

8.

OS在Uniprocessor system中,可以如何實踐semaphore,做到呼叫wait ( ) and signal ( ) 不會發生race condition?

a)

disable interrupt

b)

use test_and_set ( )

c)

use compare_and_swap ( )

9.

OS在multicore system中,可以如何實踐semaphore,做到呼叫wait ( ) and signal ( ) 不會發生race condition?

a)

disable interrupt

b)

使用硬體解決方案,test and set( ) or compare and swap( )