[理工] [OS] - deadlock free

看板Grad-ProbAsk作者 (祈附‧征前御祭)時間15年前 (2010/08/20 16:39), 編輯推噓2(206)
留言8則, 2人參與, 最新討論串1/1
Consider a computer system consisting of 4 resources of the type A and 4 resources of the type B that are shared by 3 processes. Type A and type B resources are boundled in the sense that a process always gets an A if it gets a B, and vice versa. Each of these processes requires no more than 2 resources of type A and 2 resources of type B. Is this system deadlock-free? Show proof for your answer. 這類題目我都是用鴿籠原理去想 如果是問答題好像比較難下筆 解答寫說: ΣMax[i] = 6 ΣMax[i] = ΣNeed[i] + ΣAllocation < 4 + 3 想問最後的不等式怎麼得到? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.126.34

08/21 15:48, , 1F
ΣMax[i] = ΣNeed[i] + ΣAllocation
08/21 15:48, 1F

08/21 15:48, , 2F
是假設所有資源被配置出去的情況下
08/21 15:48, 2F

08/21 15:49, , 3F
此時 ΣAllocation = m => ΣNeed[i] < n
08/21 15:49, 3F

08/21 15:50, , 4F
由鴿籠可以知道有人已經不需要資源 可順利完工
08/21 15:50, 4F

08/21 16:02, , 5F
原來是這樣 我是直接想 "每人都不足1個時資源還有剩"
08/21 16:02, 5F

08/21 16:04, , 6F
q是每個process最多要求 所以 n(q-1) < m
08/21 16:04, 6F

08/21 16:04, , 7F
也就是說解答給的是 nq < m + n 囉?
08/21 16:04, 7F

08/21 17:24, , 8F
可以這樣想吧
08/21 17:24, 8F
文章代碼(AID): #1CRZzTDk (Grad-ProbAsk)