Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Operating Systems Internals and Design Principles

Authors: William Stallings

8th edition

133805913, 978-0133805918

More Books

Students also viewed these Programming questions

Question

=+2 Identify the treatment and response.

Answered: 1 week ago

Question

Briefly define feedback scheduling.

Answered: 1 week ago

Question

Why are x and R charts used together?

Answered: 1 week ago