In: Computer Science
Consider a system consisting of 4 resources of the same type that are shared among 3 processes, each of which needs at most 2 resources. Show that the system is deadlock-free. Hint: Show that the condition ((claim-allocated) <= available) can always be satisfied.
Lets us consider the processes are P1,P2,P3.
Here the resources are of same type and there are 4 resources available
We will give one resource to each process initially
Now,1 resource is available
Inorder to any process to complete its execution they need atmost two resources
therefore we give the additional remaining 1 resource to the process P1.
Here ((claim-allocated)<=allocated) =((1-1)<=0) is satisfied
Now after the process P1 execution gets completed it will releases the resources with it
Now available=2, P2 will starts and ((claim-allocated)<=allocated) =((1-1)<=2) is satisfied
Now after the process P2 execution gets completed it will also releases the resources with it
Now available=3, P3 will starts and ((claim-allocated)<=allocated) =((1-1)<=3) is satisfied
And P3 will completes its execution
Here we can conclude that the system is in safe state and there is no deadlock