GATE - 2000 | OS | Let m[0]…m[4] be mutexes (binary semaphores) and P[0] …. P[4] be

GATE - 2000 | OS | Let m[0]…m[4] be mutexes (binary semaphores) and P[0] …. P[4] be
Posted on 26-02-2022

GATE - 2000 [Operating System]

Questions:

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) mode 4]);

 

  ------

 

  release (m[i]); release (m[(i+1)mod 4]);

This could cause:
(A) Thrashing
(B) Deadlock
(C) Starvation, but not deadlock
(D) None of the above

 

Solution:

Option (B) is Correct.

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) mode 4]);    ------    release (m[i]); release (m[(i+1)mod 4]);  This could cause: (A) Thrashing (B) Deadlock (C) Starvation, but not deadlock (D) None of the above

 

Thank You