Handling Deadlocks: Avoidance

Consider a slightly different state with 3 processes and 12 disks:

Process Maximum Needed: Currently Allocated: Available:
P0
10
5
2
P1
4
2
P2
9
3

Although process P1 can safely use 2 of the available disks to finish its work, the 4 disks that will become available after P1 finishes executing won't satisfy the requests of neither of P0 nor P2 since 10 - 5 = 5 > 4 and 9 - 3 = 6 > 4, so there are not enough available disks for these requests.

In other words, this is an unsafe state. This, however, doesn't mean that we will get a deadlock, as some of the processes might release the used resources voluntarily, which will increase the number of available disks, and therefore never cause a deadlock.