Suppose thread A acquires lock L1, then thread B acquires lock L2. Now A tries to acquire L2 while B tries to acquire L1. What is this situation called?
AStarvation
BRace condition
CPriority inversion
DDeadlock
Answer & Solution
Correct answer: D. Deadlock
1. DEADLOCK occurs when two or more threads are each waiting for resources held by the other(s) — none can proceed.
2. The example above: A holds L1, wants L2; B holds L2, wants L1. Neither can advance until the other releases — they're locked in a permanent wait.
3. Four CONDITIONS for deadlock (Coffman conditions): mutual exclusion + hold-and-wait + no preemption + circular wait. All four must hold for deadlock to occur.
4. STARVATION (option A) is different: a thread is repeatedly skipped by the scheduler but isn't fundamentally blocked.
RACE (option B) is incorrect ordering of independent ops.
PRIORITY INVERSION (option C) is when a low-priority thread holds a lock a high-priority thread needs.
_Source: OSTEP Ch 32 (Deadlock — referenced from Ch 28) + general OS theory._
Keep practising Operating Systems
Browse all Operating Systems questions for GATE CSE, or explore more Computer Science topics.
Related questions
On a MULTI-CORE system, a SPIN LOCK is generallyA LIVELOCK differs from a DEADLOCK in thatA CRITICAL SECTION isA LOCK is considered FAIR ifA LOCK (mutex) is used by concurrent threads toWhich of the following is NOT typically minimised by a CPU scheduler?The PRIMARY DISADVANTAGE of FIFO scheduling isJobs A (run time 100, arrival 0), B (run time 10, arrival 0), C (run time 10, arrival 0) u