Opening the paper…
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? Figure from the original question paper Figure from the original question paper