Question: Assume there are three processes in the system, competing for four resources (R1, R2, R3, R4). Each one is protected by a semaphore. The

 Assume there are three processes in the system, competing for four resources  

Assume there are three processes in the system, competing for four resources (R1, R2, R3, R4). Each one is protected by a semaphore. The programs are as follows: P1 Code P2 Code P3 Code /* Some stuff happened above*/ /* Some stuff happened above*/ /* Some stuff happened above*/ R1.Wait(); R4.Wait(); R3.Wait(); R2.Wait(); R3.Wait(); // P1 has what it needs R2.Wait(); R3.Wait(); R2.Wait(); R1.Wait(); //P2 has what it needs //P3 has what it needs /* Execute critical section*/ /* Execute critical section */ /* Execute critical section */ R3.Signal(); R3.Signal(); R1.Signal(); R2.Signal(); R1.Signal(); R2.Signal(); R4.Signal(); R2.Signal(); R3.Signal(); a) Show, using a resource allocation graph (or by other convincing arguments) that this system contains within it the possibility of deadlock. Activate Wind the Go to Settings to b) Suggest a way to re-order the code that ensures there will not be deadlock, but preserves necessary mutual exclusion.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!