Question 19
Consider the following scenario where two processes are sharing a common variable.
Global setup
int lock[2]= {0,0};Process 1
while(1){ lock[0] = 1; while(lock[1]); // critical section lock[0] = 0; // remainder section}Process 2
while(1){ lock[1] = 1; while(lock[0]); // critical section lock[1] = 0; // remainder section}Select the correct statements about the above processes.
It achieves mutual exclusion.
It could cause deadlock.
Process 2 can enter the critical section multiple times before a context switch if Process 1 is in remainder section.
Process 2 can enter the critical section multiple times before a context switch if Process 1 is waiting to enter the critical section.