Process Synchronization · Operating System
41 questions · asked in 23 of 27 years (2000–2026)
MCQ 34 · MSQ 4 · NAT 31-mark 22 · 2-mark 19
2000Questions per year2026
Questions 41–41 of 41
Let be mutexes (binary semaphores) and 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
Answer: (B)
With the index , the first and second mutexes of each process are:
P0: m[0], m[1]
P1: m[1], m[2]
P2: m[2], m[3]
P3: m[3], m[0]
P4: m[4], m[1]
Suppose every process runs its first
This can happen, but it does not always happen, so the code "could cause" deadlock. Thrashing is a memory-management problem, so (A) is wrong. (C) and (D) are wrong because deadlock is possible.
Answer: (B)
P0: m[0], m[1]
P1: m[1], m[2]
P2: m[2], m[3]
P3: m[3], m[0]
P4: m[4], m[1]
Suppose every process runs its first
wait before any process runs its second. Then P0 holds m[0] and waits for m[1], which P1 holds. P1 holds m[1] and waits for m[2], held by P2. P2 holds m[2] and waits for m[3], held by P3. P3 holds m[3] and waits for m[0], held by P0. This is a circular wait. None of them can run its critical section or release a mutex. P4 holds m[4] and waits for m[1], so it is stuck too.This can happen, but it does not always happen, so the code "could cause" deadlock. Thrashing is a memory-management problem, so (A) is wrong. (C) and (D) are wrong because deadlock is possible.
Answer: (B)
Keep practising
Topics in Operating System
System CallProcessThread
Process SynchronizationYou are here
DeadlockCPU SchedulingDisk SchedulingMemory ManagementFile Systems