Q1. Solve the following problem of Deadlock avoidance. Allocate the resources such that all the process are executed safe and no deadlock is occur.
Total instances of a resource=12
Process |
Has |
Maximum |
P1 |
5 |
10 |
P2 |
2 |
4 |
P3 |
2 |
9 |
Free |
Process | Has | Maximum | Need |
P1 | 5 | 10 | 5 |
P2 | 2 | 4 | 2 |
P3 | 2 | 9 | 7 |
Available resource = 12 - ( ) = 12 - (5+2+2) = 3.
Now with the available resource, first P2's request can be satisfied since it's requirement is less than available.
After P2 requirement is satisfied, new available resource is 3+2 = 5.
With this P1's requirement can be satisfied. After P1 is finished executing, new available resource is 5+5 = 10.
With this Person requirement can be satisfied.
Thus the process are executed in order : P2 -> P1 -> P3.
Since the process has finished execution in some order, the system is not in deadlock.
If you have any questions comment down and please? upvote thanks....
Get Answers For Free
Most questions answered within 1 hours.