@flash12
Deadlock free condition is:
R ≥ P(N−1) + 1
Where R is total number of resources,
P is the number of processes, and
N is the max need of each resource.
For (N-1) resources it is deadlocked, because max need is N resources. Now, as they share same resource type.
P(N−1) --> This means each process P share (N-1) resources which is a deadlock, so it needs at least 1 resource to be deadlock free.
Example: Three processes needs 3 resources each.
so we give only 2 resources each that's deadlock. right?
now give just +1 extra resource to first process only you ll see first process is deadlock free and releases its resources, which help 2nd process to get free similarly 3rd.
Hope it helps.