Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 (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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started