Termination detection - PowerPoint PPT Presentation

About This Presentation
Title:

Termination detection

Description:

[Sometimes prevention is more expensive than detection and recovery. ... Has many similarities with Dijkstra-Scholten's termination detection algorithm ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 17
Provided by: Sukuma7
Category:

less

Transcript and Presenter's Notes

Title: Termination detection


1
Termination detection
  • During the progress of a distributed computation,
  • processes may periodically turn active or
    passive.
  • A distributed computation termination when
  • (a) every process is passive,
  • (b) all channels are empty, and
  • (c) the global state satisfies the desired
    postcondition

2
Visualizing diffusing computation
initiator
active
passive
Notice how one process engages another process.
Eventually all processes turn white, and no
message is in transit -this signals termination.
How to develop a signaling mechanism to detect
termination?
3
Dijkstra-Scholten algorithm
The basic scheme
  • Node j engages node k.
  • An initiator initiates termination detection
  • by sending signals (messages) down the
  • edges via which it engages other nodes.
  • At a suitable time, the recipient sends an
  • ack back.
  • When the initiator receives ack from every
  • node that it engaged, it detects termination.

j
k
signal
j
k
j
k
ack
4
Dijkstra-Scholten algorithm
  • Deficit (e) of signals on edge e - of ack
    on edge e
  • For any node, C total deficit along incoming
    edges
  • and D total deficit along outgoing
    edges edges
  • For the initiator, by definition, C 0
  • Dijkstra-Scholten algorithm used the following
    two
  • Invariants to develop their algorithm
  • Invariant 1. (C 0) ? (D 0)
  • Invariant 2. (C gt 0) ? (D 0)

0
1
2
3
4
5
5
Dijkstra-Scholten algorithm
  • The invariants must hold when
  • an interim node sends an ack.
  • So, acks will be sent when
  • (C-1 0) ? (C-1 gt 0 ??D0)
  • follows from INV1 and INV2
  • (C gt 1) ?? (C 1 ? D0)
  • (C gt 1) ??(C 1 ? D0)

0
1
2
3
4
5
6
Dijkstra-Scholten algorithm
0
  • program detect for an internal node i
  • initially C0, D0, parent i
  • do m signal ? (C0) ?
  • C1 state active parent sender
  • this node can send out messages to engage other
    nodes, or turn passive
  • m ack ? D D-1
  • (C1? D0) ? state passive ?
  • send ack to parent C 0 parent i
  • m signal ? (C1) ?
  • send ack to the sender
  • od

1
2
3
4
5
Note that the engaged nodes induce a spanning tree
7
Distributed deadlock
  • Assume each process owns a few resources, and
    review how resources are allocated.
  • Why deadlocks occur?
  • - Exclusive (i.e not shared) resources
  • - Non-preemptive scheduling
  • - Circular waiting by all or a subset of
    processes

8
Distributed deadlock
  • Three aspects of deadlock
  • deadlock detection
  • deadlock prevention
  • deadlock recovery

9
Distributed deadlock
  • May occur due to bad designs/bad strategy
  • Sometimes prevention is more expensive than
    detection and recovery. So designs may not care
    about deadlocks, particularly if it is rare.
  • Caused by failures or perturbations in the system

10
Wait-for Graph (WFG)
  • Represents who waits for whom.
  • No single process can see the WFG.
  • Review how the WFG is formed.

11
Another classification
  • Resource deadlock
  • R1 AND R2 AND R3
  • also known as AND deadlock
  • Communication deadlock
  • R1 OR R2 OR R3
  • also known as OR deadlock

12
Detection of resource deadlock
  • Notations
  • w(j) true ? (j is waiting)
  • depend j,i true ??
  • j ? succn(i) (ngt0)
  • P(i,s,k) is a probe
  • (iinitiator, s sender, rreceiver)

2
1
3
4
P(4,4,3)
initiator
13
Detection of resource deadlock
  • Program for process k
  • do P(i,s,k) received ?
  • wk ? (k ? i) ?? dependk, i ?
  • send P(i,k,j) to each successor j dependk,
    i true
  • P(i,s, k) received ??wk ? (k i) ? process k
    is deadlocked
  • od

14
Observations
  • To detect deadlock, the initiator must be in a
    cycle
  • Message complexity O(E)
  • (edge-chasing algorithm)

Eset of edges
Should the links be FIFO?
15
Communication deadlock
This has a resource deadlock but no
communication deadlock
16
Detection of communication deadlock
  • A process ignores a probe, if it is not waiting
    for any process. Otherwise,
  • first probe ?
  • mark the sender as parent
  • forwards the probe to successors
  • Not the first probe ?
  • Send ack to that sender
  • ack received from every successor ?
  • send ack to the parent
  • Communication deadlock is detected
  • if the initiator receives ack.

Has many similarities with Dijkstra-Scholtens
termination detection algorithm
Write a Comment
User Comments (0)
About PowerShow.com