Lecture #9: Distributed Deadlock Detection

These topics are from Chapter 7 (Distributed Deadlock Detection) in Advanced Concepts in OS

Topics for Today

System Model

Distributed Deadlock Models

Based on WFG (not GRG)

The text fudges a bit by forgetting that in some models the existence of a cycle is necessary but not sufficient, and the existence of a knot is sufficient but not necessary, leaving a gap.

Distributed Deadlock Handling Strategies

Distributed Deadlock Detection Issues

What do we do when a deadlock is detected?

Categorization of Methods

Simple Centralized Control

What are the advantages and disadvantages?

If we try to improve this algorithm by having each site maintaining its own WFG locally and sending the information to the control site periodically, we may have false deadlocks:

False Deadlock Example

Two transactions run concurrently:

T1: lock R1 T2: lock R1
T1: unlock R1
T2: unlock R1
T1: lock R2
T2: lock R2
T1: unlock R2
T2: unlock R2

False Deadlock Example: Event Trace Diagram

Ho-Ramamoorthy Algorithm: Two-Phase

May still report false deadlocks.

Ho-Ramamoorthy Algorithm: One-Phase

Notice the similarity in principle here to the Chandy-Lamport global sate recording algorithm, i.e., we need to capture not just the states of the processes but also the states of the messages in transit.

Classification of Distributed Detection Algorithms

Obermarck's Path-Pushing Algorithm

How can we totally order the transactions?

Obermarck's Path-Pushing Algorithm

  1. wait for info from previous iteration of Step 3
  2. combine received info with local TWFG
    detect all cycles
    break local cycles
  3. send each cycle including the node Ex
    to the external nodes it is waiting for
  4. time-saver: only send path to other sites if last
    transaction is higher in lexical order than the first
Note: In the textbook, the rule above is reversed, i.e., it says to only send the path of the first transaction is higher in lexical order than the first. Either rule will work. The essential idea is simply to have one canonical representation of each path.




Problems with Obermarck's Path-Pushing Algorithm

Detects false deadlocks, due to asynchronous snapshots at different sites.

Message complexity? Message size? Detection delay?

Exactly how are paths combined and checked?


Obermarck's Path-Pushing Algorithm: Performance


Chandy-Misra-Haas Edge-Chasing Algorithm

Terminology

Algorithm Initiation by Pi

if Pi is locally dependent on itself then declare a deadlock
else send probe (i, j, k) to home site of Pk for each j, k such that all of the following hold


Algorithm on receipt of probe (i,j,k)

check the following conditions

if these are all true, do the following




Chandy Misra Haas Complexity


Analysis

Diffusion Based Algorithms: Chandy et al.

On receipt of query(i,j,k) by m






On receipt of reply(i,j,k) by k


The black dashed arrows indicate the engaging process for each engaged process. This information is needed to route the reply when the number of other processes for which the engaged process is waiting goes to zero.



Observe that the engaging process arrows form a spanning tree of the subgraph corresponding to the set of process for which the initiating process is waiting. If every process in this subgraph is blocked, we have a knot.


At this point, a knot has been detected.


Global State Detection Based Algorithms

Details differ.

Recall: What is graph reduction?


Graph Reduction

General idea: simulate the result of execution, assuming all unblocked processes complete without requesting any more resources