Skip to main content

Threads and Concurrency

Deadlocks

0:00
LearnStep 1/3

Deadlock Conditions

Deadlocks

A deadlock occurs when processes are waiting for resources held by each other.

Four Necessary Conditions (Coffman)

  1. Mutual Exclusion: Resources cannot be shared
  2. Hold and Wait: Process holds resources while waiting
  3. No Preemption: Resources cannot be forcibly taken
  4. Circular Wait: Circular chain of waiting processes

Example

Resource Allocation Graph