Deadlocks
A deadlock is a situation in which two or more processes are blocked and each is waiting for a resource held by another, so no one can proceed. Deadlocks are a concern in operating systems, databases, and distributed systems where resources such as mutexes, locks, files, or memory are shared.
Four conditions are necessary for a deadlock: mutual exclusion; hold and wait; no preemption; and circular wait
Deadlocks can occur when resources are scarce and requests are granted incrementally, such as two threads each
Prevention and avoidance strategies aim to break one of the four conditions. Approaches include enforcing resource
Detection and recovery mechanisms monitor resource allocation to identify deadlocks, for example via wait-for graphs; upon
The dining philosophers problem is a classic illustration of deadlock and is used to study synchronization