Answer:
Answer: (b) As request(P1) < Available, we can grant request
(c) As request(P4) < Available, we can grant request
Explanation:
Need Matrix
Need [i, j] = Max [i, j] – Allocation [i, j]
A B C D
P0 2 2 1 1
P1 2 1 3 1
P2 0 2 1 3
P3 0 1 1 2
P4 2 2 3 3
Available = (3 3 2 1)
1. Need(P0) < Available so, P0 can take all resources
Available = (3 3 2 1) + (2 0 0 1) (Allocation of P0) = (5 3 2 2)
2. Need(P3)<Available so, P3 will go next
Available = (5 3 2 2) + (1 3 1 2) = (6 6 3 4)
Like wise next P4, P1, P2 will get resources.
So safe sequence is P0 , P3, P4, P1, P2
b.
Request from P1 is (1 1 0 0) and Available is (3 3 2 1)
As request(P1) < Available, we can grant request
c.
Request from P4 is (0 0 2 0) and Available is (3 3 2 1)
As request (P4) < Available, we can grant request