Correct Answer - Option 2 : Safe, Not Deadlocked
Resource allocation table:
Process
|
Current Allocation
|
Maximum Requirement
|
Need
(Maximum-current)
|
P1
|
3
|
7
|
4
|
P2
|
1
|
6
|
5
|
P3
|
3
|
5
|
2
|
Available = 9 – ∑ (current allocation to process) = 9 – 7 = 2
Now, 2 resource will satisfy the need of P3.
After this available = 2 + 3 = 5
5 resource can satisfy need of P2 or P1
CASE 1:
If P2 is executed before P1,
Available = 5 + 1 =6
6 resource can satisfy the need of P1 easily.
CASE 2:
If P1 is executed before P2
Available = 5 + 3 = 8
8 resource can satisfy the need of P1 easily.
Safe sequence will be P3, P1, P2 and P3, P2, P1
System is safe and there is no deadlock in the system.