Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume there are three processes (P1, P2, P3) in the system, competing for four resources: (MONITOR, NETWORK, PRINTER, USB). Each resource is protected by
Assume there are three processes (P1, P2, P3) in the system, competing for four resources: (MONITOR, NETWORK, PRINTER, USB). Each resource is protected by a semaphore that ensures mutually exclusive access to the resource (ie: a process must call USB.Wait() before using USB). The programs are as follows: P1 Code P2 Code /* Some stuff happened above*/ /* Some stuff happened above*/ MONITOR.Wait(); NETWORK.Wait(); PRINTER.Wait(); /* Execute critical section*/ // P1 has what it needs PRINTER.Signal(); NETWORK.Signal(); MONITOR.Signal(); USB.Wait(); MONITOR.Wait(); PRINTER.Wait(); //P2 has what it needs /* Execute critical section */ PRINTER.Signal(); MONITOR.Signal(); USB.Signal(); P3 Code /* Some stuff happened above*/ NETWORK.Wait(); PRINTER.Wait(); MONITOR.Wait(); //P3 has what it needs /* Execute critical section */ MONITOR.Signal(); USB.Signal(); NETWORK.Signal(); a) Show, using a resource allocation graph (or by other convincing arguments) that this system contains within it the possibility of deadlock. Activate Win b) Suggest a way to re-order the code that ensures there will not be deadlock, but preserves the Go to Settings to 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