Open In App

Chandy-Misra-Haas’s Distributed Deadlock Detection Algorithm

Improve
Improve
Like Article
Like
Save
Share
Report

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: 

  1. 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. 
     
  2. 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. 

Data structures: 
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

Algorithm: 

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. 

Performance:  

  • 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).

Advantages:  

  • 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 algorithm.
  • Algorithm does not report any false deadlock (also called phantom deadlock).

Disadvantages: 

  • The main disadvantage of distributed detection algorithms is that all sites may not be aware of the processes involved in the deadlock which makes resolution difficult. Also, proof of correction of the algorithm is difficult.
  • It may detect a false deadlock if there is a delay in message passing or if a message is lost. This can result in unnecessary process termination or resource preemption.
  • It may not be able to detect all deadlocks in the system, especially if there are hidden deadlocks or if the system is highly dynamic.
  • It is complex and difficult to implement correctly. It requires careful coordination between the processes, and any errors in the implementation can lead to incorrect results.
  • It may not be scalable to large distributed systems with a large number of processes and resources. As the size of the system grows, the overhead and complexity of the algorithm also increase.
     

Last Updated : 13 May, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads