4. [30] Assume there are five processes, P1 through P5 and four resources: R1 (6 instances), R2
(7 instances), R3 (14 instances), R4 (12 instances).
Available: R1: 2, R2: 1, R3: 2, R4: 0
Allocation
Max
Need
Process R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4
P1 0 0 1 2 0 0 3 2 0 0 2 0
P2 2 0 0 0 2 7 5 0 0 7 5 0
P3 0 0 3 4 6 6 5 6 6 6 2 2
P4 2 3 5 4 4 3 5 6 2 0 0 2
P5 0 3 3 2 0 6 5 2 0 3 2 0
(a) Is this system currently deadlocked, or can any process become deadlocked? Why or why
not? If not deadlocked, give an execution order.
(b) If a request from a process P1 arrives for (0, 4, 2, 0), can the request be immediately
granted? Why or why not? If yes, show an execution order.
(c) If a request from a process P2 arrives for (0, 1, 2, 0), can the request be immediately
granted? Why or why not? If yes, show an execution order.