Two processes, P_1 and P_2, need to access a critical section of code.…

GATE · 2007 · CS

Two processes, P_1 and P_2, need to access a critical section of code. Consider the following synchronization construct used by the processes: Here, wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct?

P1​(i)

P2​(j)

While(true)

While(true)

{

{

wants1 = T;

wants2 = T;

While (wants2 == T);

While (wants1 == T);

Critical section

Critical section

wants1 = F;

wants2 = F;

Remainder section

Remainder section

}

}

  1. A.

    It does not ensure mutual exclusion.

  2. B.

    It does not ensure bounded waiting.

  3. C.

    It requires that processes enter the critical section in strict alternation.

  4. D.

    It does not prevent deadlocks, but ensures mutual exclusion

Attempted by 348 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…