确定哪些请求可以被授予 edge of hold、wait 和 illegal
Determining which request can be granted as edge of hold,wait and illegal
考虑资源分配图:-
假设请求顺序为:
P4 → R3
P1 → R4
P3 → R1
P2 → R3
P4 → R2
P5 → R4
哪些请求可以被授予而不至于出现死锁?
我尝试解决它,但只需要提醒一下,因为我在浏览不同的图表时感到困惑,结果不同。
这是我的答案-
P4 → R3 - 保持
P1 → R4 - 等待
P3 → R1 - 等待
P2 → R3 - 等待
P4 → R2 - 非法
P5 → R4 - 等待
我得出的答案和你说的一样,恭喜你自己解决了。我只是向未来的访客介绍一下:-
P4 -> R3 ------ will hold as one instance of R3 is available.
P1 -> R4 ------ will wait as the only instance of R4 is occupied by P4.
P3 -> R1 ------ will wait as the only instance of R1 is occupied by P1.
P2 -> R3 ------ will wait as both instances of R3 are occupied by P3 and P4.
P4 -> R2 ------ will be illegal due to satisfying circular wait condition.
Explanation of above ---> P4 needs R2, which is occupied by P2 and P5. P2 needs R3 which is
occupied by P4 itself. So, here's a cycle which is an unsafe state.
Hence, this will result in deadlock due to circular wait.
P5 -> R4 ------ will wait in queue after P1, as P1 has requested for R4
before than P5.
注意:- 我们不会考虑第 5th 种情况,因为它会导致死锁,因此不会在评估进程未来的资源请求。
考虑资源分配图:-
假设请求顺序为:
P4 → R3
P1 → R4
P3 → R1
P2 → R3
P4 → R2
P5 → R4
哪些请求可以被授予而不至于出现死锁?
我尝试解决它,但只需要提醒一下,因为我在浏览不同的图表时感到困惑,结果不同。
这是我的答案-
P4 → R3 - 保持
P1 → R4 - 等待
P3 → R1 - 等待
P2 → R3 - 等待
P4 → R2 - 非法
P5 → R4 - 等待
我得出的答案和你说的一样,恭喜你自己解决了。我只是向未来的访客介绍一下:-
P4 -> R3 ------ will hold as one instance of R3 is available.
P1 -> R4 ------ will wait as the only instance of R4 is occupied by P4.
P3 -> R1 ------ will wait as the only instance of R1 is occupied by P1.
P2 -> R3 ------ will wait as both instances of R3 are occupied by P3 and P4.
P4 -> R2 ------ will be illegal due to satisfying circular wait condition.
Explanation of above ---> P4 needs R2, which is occupied by P2 and P5. P2 needs R3 which is occupied by P4 itself. So, here's a cycle which is an unsafe state. Hence, this will result in deadlock due to circular wait.
P5 -> R4 ------ will wait in queue after P1, as P1 has requested for R4
before than P5.
注意:- 我们不会考虑第 5th 种情况,因为它会导致死锁,因此不会在评估进程未来的资源请求。