Chandy-Misra-Haas’s distributed deadlock detection algorithm is an edge chasing algorithm to detect deadlock in distributed systems.
In edge chasing algorithm, a special message called probe is used in deadlock detection. A probe is a triplet (i, j, k) which denotes that process Pi has initiated the deadlock detection and the message is being sent by the home site of process Pj to the home site of process Pk.
The probe message circulates along the edges of WFG to detect a cycle. When a blocked process receives the probe message, it forwards the probe message along its outgoing edges in WFG. A process Pi declares the deadlock if probe messages initiated by process Pi returns to itself.
Other terminologies used in the algorithm:
- Dependent process:
A process Pi is said to be dependent on some other process Pj, if there exists a sequence of processes Pi, Pi1, Pi2, Pi3…, Pim, Pj such that in the sequence, each process except Pj is blocked and each process except Pi holds a resource for which previous process in the sequence is waiting.
- Locally dependent process:
A process Pi is said to be locally dependent on some other process Pj if the process Pi is dependent on process Pj and both are at same site.
A boolean array, dependenti. Initially, dependenti[j] is false for all value of i and j. dependenti[j] is true if process Pj is dependent on process Pi.
Process of sending probe:
1. If process Pi is locally dependent on itself then declare a deadlock.
2. Else for all Pj and Pk check following condition:
- (a). Process Pi is locally dependent on process Pj
- (b). Process Pj is waiting on process Pk
- (c). Process Pj and process Pk are on different sites.
If all of the above conditions are true, send probe (i, j, k) to the home site of process Pk.
On the receipt of probe (i, j, k) at home site of process Pk:
1. Process Pk checks the following conditions:
- (a). Process Pk is blocked.
- (b). dependentk[i] is false.
- (c). Process Pk has not replied to all requests of process Pj
If all of the above conditions are found to be true then:
1. Set dependentk[i] to true.
2. Now, If k == i then, declare the Pi is deadlocked.
3. Else for all Pm and Pn check following conditions:
- (a). Process Pk is locally dependent on process Pm and
- (b). Process Pm is waiting upon process Pn and
- (c). Process Pm and process Pn are on different sites.
4. Send probe (i, m, n) to the home site of process Pn if above conditions satisfy.
Thus, the probe message travels along the edges of transaction wait-for (TWF) graph and when the probe message returns to its initiating process then it is said that deadlock has been detected.
- Algorithm requires at most exchange of m(n-1)/2 messages to detect deadlock. Here, m is number of processes and n is the number of sites.
- The delay in detecting the deadlock is O(n).
- There is no need for special data structure. A probe message, which is very small and involves only 3 integers and a two dimensional boolean array dependent is used in the deadlock detection process.
- At each site, only a little computation is required and overhead is also low
- Unlike other deadlock detection algorithm, there is no need to construct any graph or pass nor to pass graph information to other sites in this algoirthm.
- Algorithm does not report any false deadlock (also called phantom deadlock).
The main disadvantage of a distributed detection algorithms is that all sites may not aware of the processes involved in the deadlock this makes resolution difficult. Also, proof of correction of the algorithm is difficult.
- Deadlock detection in Distributed systems
- Deadlock Detection in Distributed Systems
- Hierarchical Deadlock Detection in Distributed System
- Deadlock Detection Algorithm in Operating System
- Deadlock Detection And Recovery
- Algorithm for implementing Distributed Shared Memory
- Huang's Termination detection algorithm
- Lamport's Algorithm for Mutual Exclusion in Distributed System
- Maekawa’s Algorithm for Mutual Exclusion in Distributed System
- Suzuki–Kasami Algorithm for Mutual Exclusion in Distributed System
- Ricart–Agrawala Algorithm in Mutual Exclusion in Distributed System
- Difference between Deadlock and Starvation in OS
- Deadlock, Starvation, and Livelock
- Deadlock Prevention And Avoidance
- Conditions for Deadlock in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.