TomoLink
CompaniesInfosysOperating SystemsDeadlocks
OS
Deadlocks

Deadlocks

deadlockmutexsemaphore
1 sections
deadlock, mutex

What is a Deadlock?

Deadlock Definition

A deadlock is a situation where a set of processes are blocked, each waiting for a resource held by another process in the set.

Coffman Conditions (All 4 must hold for deadlock)

  • Mutual Exclusion: Resources cannot be shared; only one process can use a resource at a time.
  • Hold and Wait: A process holds at least one resource and is waiting for additional resources.
  • No Preemption: Resources cannot be forcibly taken from a process.
  • Circular Wait: A circular chain of processes exists, each waiting for a resource held by the next.

Deadlock Handling Strategies

  • Prevention: Eliminate one of the 4 Coffman conditions
  • Avoidance: Use Banker's Algorithm to ensure safe state
  • Detection & Recovery: Detect deadlock and kill processes or preempt resources
  • Ignorance: Ostrich algorithm — assume deadlocks won't happen (used in many OS)
Os Deadlocks | Infosys Os | TomoLink