Deadlock Handling

Conditions and strategies for dealing with deadlocks.

  • JSON4,375 B
  • YAML3,213 B · −27%
  • TOON2,725 B · −38%

The four necessary conditions for deadlock, the strategies for dealing with it (prevention, avoidance, detection and recovery) and related hazards such as livelock and starvation. Each entry is a one-line definition suitable for exam review or design discussion.

Use it when

  • You are diagnosing a hang and need the vocabulary for what is happening.
  • You are choosing between preventing deadlock and detecting it.

Watch out for

  • Most general-purpose operating systems do not prevent deadlock for user programs; they leave it to application design.
  • Banker's algorithm needs advance knowledge of maximum resource needs, which is rarely available.

The data

ConceptDescription
Mutual ExclusionAt least one resource must be non-sharable.
Hold and WaitA process holds resources while waiting for additional ones.
No PreemptionResources cannot be forcibly taken from a process.
Circular WaitA circular chain of processes each waiting for a resource held by the next.
Banker's AlgorithmDeadlock avoidance using safety checks on resource allocation.
Deadlock PreventionDesign the system so at least one necessary condition cannot hold.
Deadlock DetectionPeriodically check the resource allocation graph for cycles.
Resource Allocation GraphA directed graph of processes and resources; a cycle indicates possible deadlock, and certain deadlock when each resource has a single instance.
Safe StateA state in which there is an order in which every process can finish even if all request their maximum needs.
Deadlock AvoidanceGranting a request only if the resulting state remains safe, as the Banker's algorithm does.
Deadlock RecoveryBreaking a detected deadlock by terminating processes or preempting resources.
Lock OrderingRequiring all code to acquire locks in one global order, which removes circular wait.
LivelockProcesses keep changing state in response to each other but make no progress.
StarvationA process waits indefinitely because others are always favored; aging is a common remedy.
Ostrich AlgorithmIgnoring deadlock on the assumption that it is rare and the cost of handling it is not worth paying.

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
dataconceptstringMutual Exclusion
datadescriptionstringAt least one resource must be non-sharable.

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.yunusemrevurgun.com/api/dataset/deadlock-handling?format=toon"
const res = await fetch(
  "https://yjtoon.yunusemrevurgun.com/static-data/dataset/deadlock-handling.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • os
  • deadlock
  • concurrency

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets