Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assuming we have the following 3 processes trying to access 6 resources. We know deadlock is possible. How can you change the order of resource
Assuming we have the following 3 processes trying to access 6 resources.
We know deadlock is possible. How can you change the order of resource requests so that there is no deadlock? Obviously, the critical region of each process cannot be changed, therefore, it must be ensured that all required resources are actually acquired.
void P2() void PO () { while (true) { get (A); get (B); get (C); // critical region: // use A, B, C release (A) ; release (B); release (C); } } void P1 () { while (true) { get (D); get (E); get (B); // critical region: // use D, E, B release (D); release (E) ; release (B); } } while (true) { get (C); get (F); get (D); // critical region: // use C, F, D release (C); release (F); release (D); }
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