1. 根據第六章Synchronization內容作答

(a) 說明為何在multiprocessor系統中,不適合用interrupts實現synchronization primitives

可能會有多個程序使用同個資源造成衝突

(b) 說明race condition 發生的原因

當多個程序使用到同個資源引發的排序問題

(c) 說明critical section 為何?

process用來 changing common variables, updating table, writing file,etc
(d) 解決 critical section的三個要求為何?

Mutual Exclusion、Progress、Bounded Waiting

(e) Semaphore 分為哪兩種?如何區別?

binary semaphore (0和1)、 counting semaphore (整數)

 

2. 在synchronization 的mutex locks 中,

(a) 為何會出現busy waiting?

在signal()、wait() 一方使用資源, 一方進入busy waiting (互斥性)

(b)為何在不同情況下, busy waiting有時為優點, 有時為缺點?

缺點: 可能無限期堵塞

優點: read在busy waiting時, write在使用資源, read在使用資源時, write在busy waiting,

比較不會發生read和write在使用資源上的衝突

 

3. 在synchronization 的 semaphore 中, 曾提及"atomic operations"請問其定義為何?

沒有中斷

 

4. 根據第七章Deadlocks內容回答:

(a) Deadlock發生的四個必要條件為何?並簡要說明之

mutual exclution: 互斥性

hoald and wait: 有process拿住一個資源, 卻因為沒有另外的資源(被另一個程序拿走),而進入等待

no preemption: 不能搶奪別的process的資源,當然也不會被搶

circular wait: 舉例: A等B, B等C, C等A

(b) 一個系統處於safe state的條件為何?

工作順利完成finisj[i]==true;

如果演算法finish[i]==false;    則為unsafe state

 

5. 在討論deadlock-avoidance時, 相關的三個名詞: claim edge, request edge, assignment edge, 請說明三者意義、用途

claim edge: Rj indicated that process Pj may request
resource Rj at some time in the future; represented by a dashed line.

request edge: a process requests a resource

assignment edge:the resource is allocated to the process

 

文章標籤
全站熱搜
創作者介紹
創作者 cc08310112tw 的頭像
cc08310112tw

墨墨喵喵喵

cc08310112tw 發表在 痞客邦 留言(0) 人氣(2,127)