[理工] [OS]-97 交大

看板Grad-ProbAsk作者 (███████████)時間16年前 (2010/03/09 16:52), 編輯推噓0(007)
留言7則, 2人參與, 最新討論串1/1
Consider a system with five processes P0 through P4 and three resource types A,B,C. Resource type A has 11 instances, resource type B has 5 instances, and resource type C has 7 instances. Suppose at time T0,the following snapshot of the system has been taken ____________________________________ Allocation Max A B C A B C ____________________________________ P0 0 1 0 7 5 3 P1 2 0 0 3 2 2 P2 3 0 2 9 0 2 P3 2 1 1 2 2 2 P4 0 0 2 4 3 3 ____________________________________ Please calcucate the maximum request (consider type A fiest,then B,and C last,and all together) which can be granted for process P0,P1,P2,P3,and P4 ,respectively, for the system to be in safe states 這題引用之前有人問過 可是好像沒有說明 HOW 因為碰到這題 有點不知道該如何下筆 請問一下這題要如何解?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.223.184

03/09 18:07, , 1F
先假設給P0一組request 跑safety看有沒有deadlock
03/09 18:07, 1F

03/09 18:08, , 2F
有deadlock就降低假設的requset
03/09 18:08, 2F

03/09 18:10, , 3F
要從多少開始假設???
03/09 18:10, 3F

03/09 18:11, , 4F
另外我這邊解答P0 (4,2,1) 就是safe 可是算起來怪怪的?
03/09 18:11, 4F

03/09 18:14, , 5F
以P0來說 requset<=available然後往下看到P3 need 0 1 1
03/09 18:14, 5F

03/09 18:15, , 6F
所以我從 4 2 1開始算 然後會deadlock
03/09 18:15, 6F

03/09 18:23, , 7F
從need 最大的開始算 後面need小的可以用推的
03/09 18:23, 7F
文章代碼(AID): #1BbWnJjm (Grad-ProbAsk)