In computer science, a system that allows concurrent operation of multiple processes and locking of resources and which does not provide mechanisms to avoid or prevent deadlock must support a mechanism to detect deadlocks and an algorithm for recovering from them.
One such deadlock detection algorithm makes use of a wait-for graph to track which other processes a process is currently blocking on. In a wait-for graph, processes are represented as nodes, and an edge from process to implies is holding a resource that needs and thus is waiting for to release its lock on that resource. If the process is waiting for more than a single resource to become available (the trivial case), multiple edges may represent a conjunctive (and) or disjunctive (or) set of different resources or a certain number of equivalent resources from a collection. The possibility of a deadlock is implied by graph cycles in the conjunctive case, and by knots in the disjunctive case. There is no simple algorithm for detecting the possibility of deadlock in the final case.
The wait-for-graph scheme is not applicable to a resource allocation system with multiple instances of each resource type.
- Srinivasan, Selvaraj; Rajaram, Rajeev (January 2011). "A decentralized deadlock detection and resolution algorithm for generalized model in distributed systems". Tamil Nadu: RMD Engineering College. doi:10.1007/s10619-011-7078-7. Retrieved October 21, 2020.