Distributed Deadlock Detection

04/29/97

by Leonidas E. Rigas

The problem of deadlock in general

Consider three grannies seeking to knit jumpers. There are only three needles available. If all three grannies sought to obtain two needles at the same time, they may all get only one needle each and none of them would be able to proceed with their knitting. This situation is termed deadlock.

System model

The problem of deadlocks in distributed has been generally studied using a model with the following assumptions:

Graph-theoretical model

The state of process-resource interaction in distributed systems can be modelled by a bi-partite directed graph called a resource allocation graph. The nodes of the graph are the processes and resources of the system. The edges depict assignements or pending requests . A system is deadlocked if its resource allocation graph contains a directed cycle or a knot.

Special conditions of deadlock detection in didtributed systems

In distributed systems deadlock handling is more complicated because

Deadlock handling strategies

Deadlock Prevention: It is achieved by having a process acquire all needed resources simultaneously before it begins execution or preempting a process that helds the needed resource.

Drawbacks

Deadlock Avoidance: A resource is granted to a process if the resulting global system state is safe.

Drawbacks

Deadlock Detection: It requires an examination of the status of process-resource interactions for the presence of a cyclical wait.

Favorable conditions

Issues in deadlock detection

A correct deadlock detection algorithm must satisfy the following two conditions:

Distributed Control

In this scheme of control the responsibility for detecting a global deadlock is shared equally among all sites. The global state graph is spread over many sites and several sites participate in the detection of a global cycle.

Advantages:

Disadvantages:

The Edge-Chasing algorithm

Basic Idea: In edge-chasing algorithms, special messages called probes are circulated along the edgs of the WFG to detect a cycle. When a blocked process receives a probe, it propagates the probe along its outgoing channels on the WFG. A process declares a deadlock when it receives a probe initiated by it.

Algorithm (Chandy-Misra-Haas):

The system executes to check Pi

On receipt of probe (i,j,k) the site executes

If Pi is locally dependent on itself

then there is a deadlock

else for all Pj and Pk:

    (Pi is locally dependent upon Pj &&

    Pj is waiting on Pk &&

    Pj and Pk are on different sites)

    send probe (i,j,k) to the home site of Pk

If (Pk is blocked &&

then dependent(i) = true

    if ( k == i ) then Pi is deadlocked

    else for all Pm and Pn:

      (Pi is locally dependent upon Pj &&

      Pj is waiting on Pk &&

      Pj and Pk are on different sites)

      send probe (i,j,k) to the home site of Pk

Example:

Consider the system shown in the figure below. If process P1 initiates deadlock detection, it sends probe (1, 3, 4) to Site 2. Since P6 is waiting for P8 and P7 is waiting for P10, Site 2 sends probes (1, 6, 8) and (1, 7, 10) to Site 3 which in turn sends probe (1, 9, 1) to Site 1. On receiving probe (1, 9, 1), Site 1 declares that P1 is deadlocked.

Bibliography


All Contents Copyright © 1997 by Leonidas E. Rigas