Question: 2. Deadlock Consider the following scenario. A system has three resource types; R1 has 3 instances, R2 has 4 instances, R3 has 6. There are
2. Deadlock
Consider the following scenario. A system has three resource types; R1 has 3 instances, R2 has 4 instances, R3 has 6. There are three processes, A-C, whose code is given below.
ProcessA { Acquire(R1, 2); Acquire(R2, 1); if (condition1) { Acquire(R3, 3); Acquire(R1, 1); }else Acquire(R2, 2); ReleaseAllResources(); }
ProcessB { Acquire(R2, 1); Acquire(R3, 2); if (condition2) { Acquire(R1, 1); Acquire(R3, 1); } else { Acquire(R2, 1); Acquire(R3, 1); } ReleaseAllResources(); }
ProcessC { Acquire(R3, 2); Acquire(R1, 2); if (condition3) Acquire(R2, 1); else Acquire(R2, 2); ReleaseAllResources(); }
a. (5) What is the maximum need vector for each process?
b. (5) Draw the Resource Allocation Graph for the system when all processes have made their first three requests (assuming they dont block), in Round Robin order (one line each). Assume that if a resource is available it will be granted to the process, otherwise the process blocks. Assume all conditions are false. Is there deadlock? Explain.
c. (5) Repeat (b) but apply the Bankers Algorithm to determine whether to grant the requests each process makes. Show the final state, and explain the difference, if any.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
