Consider the following solution of critical section for two processes: Boolean…

Consider the following solution of critical section for two processes:
Boolean val[2] = {false,false};
int turn = 0;
void Pi(){
while(1){
val[i] = true;
turn = j;
while(val[j] && turn == j);
/// critical section////
val[i] = false;
}}
Here val and turn are shared variables between two processes P0 and P1, than which of the following is true about above solution ?

  1. A.

    Satisfy mutual exclusion and process both

  2. B.

    Satisfy process and bounded wait but not mutual exclusion

  3. C.

    Satisfy mutual exclusion but not process both

  4. D.

    Doesn’t satisfy any of mutual exclusion, process and bounded wait

Attempted by 332 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…