Let m[0]......m[4] be mutexes (binary semaphores) and P[0]......P[4] be…
2000
Let m[0]......m[4] be mutexes (binary semaphores) and P[0]......P[4] be processes. Suppose each process P[i] executes the following:
wait (m[i]); wait (m[(i+1) mod 4]);
......
release (m[i]); release (m[(i+1) mod 4]);
This could cause:
- A.
thrashing
- B.
deadlock
- C.
starvation, but no deadlock
- D.
none of the above
Attempted by 56 students.
Show answer & explanation
Correct answer: B
Each process P[i] acquires m[i] then waits for m[(i+1) mod 4]. This ordering creates a circular dependency where processes hold resources while waiting for others. All four necessary conditions for deadlock are satisfied, leading to system deadlock.
A video solution is available for this question — log in and enroll to watch it.