Skip to content
uencoder

Deadlock

A deadlock is multiple threads waiting on locks held by one another, resulting in permanent blocking.

Purpose

To understand the conditions that produce deadlocks and their defenses; a core concern of concurrent-program reliability.

Mechanism

The four Coffman conditions: mutual exclusion, hold-and-wait, no preemption, and circular wait. When all hold simultaneously, deadlock occurs. Defenses: lock ordering (a global order), timeouts, try-lock, avoiding nested locks.

Use cases

  • Concurrency reliability
  • Lock design
  • Deadlock detection

Related tools

References