Operating Systems, Quiz 2
Consider the following scenario where two processes are sharing a common variable.
Global setup
int turn = 1;Process 1
while(1) { while(turn == 2); // lock // critical section turn = 2; // unlock // remainder section}Process 2
while(1) { while(turn == 1); // lock // critical section turn = 1; // unlock // remainder section}Which of the following statements about the given processes is correct?
Consider the following scenario where two processes are sharing a common variable. **Global setup** int turn = 1; **Process 1** while(1) { while(turn == 2); // lock // critical section turn = 2; // unlock // remainder section } **Process 2** while(1) { while(turn == 1); // lock // critical section turn = 1; // unlock // remainder section } Which of the following statements about the given processes is correct? Assume that two processes *P*1 and *P*2 are using a shared resource. If *P*1 and *P*2 are both waiting indefinitely to enter their critical sections because each keeps waiting for the other to release the resource, then which of the following conditions is not satisfied? Figure from the original question paper