Two processes, P_1 and P_2, need to access a critical section of code.…
2007
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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- A.
It does not ensure mutual exclusion.
- B.
It does not ensure bounded waiting.
- C.
It requires that processes enter the critical section in strict alternation.
- D.
It does not prevent deadlocks, but ensures mutual exclusion
Attempted by 103 students.
Show answer & explanation
Correct answer: D
This synchronization construct lacks a turn variable, which is essential for progress in Peterson's algorithm. While mutual exclusion holds because processes check the other's flag, setting both flags to true simultaneously causes indefinite waiting. Consequently, this algorithm suffers from deadlock and does not guarantee progress.
A video solution is available for this question — log in and enroll to watch it.