Q5) Mutual Exclusion: Peterson's solution Given the following code for Peterson's solution for two processes PO and P1. Assume that PO and P1 are both trying to enter their critical section at about...


q5+6


Q5) Mutual Exclusion: Peterson's solution<br>Given the following code for Peterson's solution for two processes PO and P1. Assume that PO and<br>P1 are both trying to enter their critical section at about the same time.<br>int turn;<br>bool interested[2];:<br>void enter_CS(int process){<br>int other;<br>other = 1 - process;<br>interested[process] = TRUE;<br>turn = process;<br>while (turn == process && interested[other] == TRUE) /1* null statement */;<br>For a P1 to enter its critical section, turn should be equal to (_<br>) or interested[0]=<br>Q6) Producer Consumer Problem<br>Given a producer consumer system with buffer size of 10, assume that count=3 at some point<br>1) When the consumer reads a value from the buffer, the value of count will be (_<br>2) The producer sleeps when count becomes<br>

Extracted text: Q5) Mutual Exclusion: Peterson's solution Given the following code for Peterson's solution for two processes PO and P1. Assume that PO and P1 are both trying to enter their critical section at about the same time. int turn; bool interested[2];: void enter_CS(int process){ int other; other = 1 - process; interested[process] = TRUE; turn = process; while (turn == process && interested[other] == TRUE) /1* null statement */; For a P1 to enter its critical section, turn should be equal to (_ ) or interested[0]= Q6) Producer Consumer Problem Given a producer consumer system with buffer size of 10, assume that count=3 at some point 1) When the consumer reads a value from the buffer, the value of count will be (_ 2) The producer sleeps when count becomes

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here