Question: Consider the following solution to the critical - section problem for two processes. 5 boolean flag [ 2 ] ; int turn; boolean flag [

Consider the following solution to the critical-section problem for two processes.
5
boolean flag [2];
int turn;
boolean flag[0]= FALSE;
boolean flag[1]= FALSE; do (flag [i]= true; while (flag [j])(if (turn ==1){flag [1]= TRUE; while (turn == j); flag [i]= TRUE;
CRITICAL SECTION turn = j; flag [i]= FALSE; remainder section while (1)
Two process Po and P, share the flag and turn variable. The structure of the process P,(i ==0 or 1), with Pi (i==1 or 0) being the other process.
If the initial value of turn is 0, which of the following is TRUE, about the above solution?
The proposed solution fails to guarantee mutual exclusion.
This solution guarantee mutual exclusion and prevent deadlock.
This solution fails to prevent deadlock.
This solution fails to guarantee mutual exclusion and fails to prevent deadlock

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!