termination detection of diffusing computations
DESCRIPTION
Termination Detection of Diffusing Computations. Chapter 19 Distributed Algorithms by Nancy Lynch Presented by Jamie Payton Oct. 3, 2003. Motivation. We would like to simplify programming of asynchronous networks Use a monitoring algorithm Debugging Backup Termination detection - PowerPoint PPT PresentationTRANSCRIPT
Termination Detection of Diffusing Computations
Chapter 19Distributed Algorithms by Nancy Lynch
Presented by Jamie PaytonOct. 3, 2003
Motivation
We would like to simplify programming of asynchronous networks Use a monitoring algorithm
Debugging Backup Termination detection Deadlock detection Global quantity computation
Approaches
Stable property detection Any property of the global state that, once
established, remains true E.g., deadlock or termination
Consistent global snapshots Captures the global state of the network such
that it appears to all processes to have been taken at the same instant on every process
Asynchronous Networks
Collection of processesCollection of channelsCommunication subsystem
Point-to-point Broadcast Multicast
Network Model
n-Node directed graph G=(V,E)
Represent n processes as nodes in graphRepresent channels as directed edges in
graph
Send/Receive Model
Processes Input actions
Receive(m)i,j
Output actions Send(m)i,j
Channels Input actions
Send(m)i,j
Output actions Receive(m)i,j
Each process associated with a node and each channel associated with an edge in the graph G
is modeled as an I/O automaton
Termination Detection for Diffusing Computations
All processes are initially quiescentA designated “live” process diffuses
computation to other processesProcesses awaken, perform work, spread
computationProcesses become quiescent again When all processes become quiescent,
then termination should be signaled
Problem Statement (1)
Initially No locally controlled actions can be performed All channels are empty
A single process is awakened with an input event from the environment It can perform an output action to generate an event, send, for
other processes A process performs an input action, receive, which
wakes up the process Awakened processes perform tasks and spread
computation with output actions A process becomes quiescent again when
No locally controlled action can be performed; No messages exist in its channel
Problem Statement (2)
Given the initial state of the network as described,
If a process Ai at node ni receives an input event,
and after some time a global quiescent state is reached,
then a special donei output should be performed at node i
Detecting Termination
Detect termination of algorithm A with a monitoring algorithm, B(A) Send/receive algorithm Based on the graph G Issues a special done output when termination
is detected
Dijkstra-Scholten Algorithm(1)
Basic idea: Augment the diffusing algorithm with
construction and maintenance of a spanning tree
Tree is rooted at the source node of the diffusing computation
Tree includes all active nodes Tree grows/shrinks as nodes become
active/idle
Dijkstra-Scholten Algorithm(2)
All nodes are initially idle A single node, the source of the diffusing
computation, becomes active An idle node receives a message from the
diffusing computation algorithm, A Becomes active Records the sender as its parent Does not ack the message until ready to become
idle again An active node must wait for all outgoing
messages to be acknowledged before becoming idle again
Example
A1 A4
A3
A2
Dijkstra-Scholten Automaton (1)
Signature of DS(Ai) Signature of Ai
Input Receive(“ack”)j,I where j nbrs
Output Send(“ack”)i,j where j nbrs
Internal Cleanupi
Donei
Dijkstra-Scholten Automaton (2)
State information for DS(Ai) All state info for diffusing computation Ai
si {idle, root, non-root}, initially idle
pi nbrs {null}, initially null
j nbrs: send-buffer(j), a FIFO queue of ack msgs, initially
empty deficit(j) N, initially 0
Dijkstra-Scholten Automaton (3)
Transitions See handout
Lemma
In any state after an input at node i, si {root, idle} and pi = null j≠i, sj{idle, non-root}, and if sj=non-root, then pj = null j, if sj=idle then the projected state of Aj is quiescent,
pj=null, and deficit(k)j=0 for every k j,k, deficit(k)j = numMsgsj,k + numBufAcksj,k +
numAcksj,k + {1 if pk = j, 0 otherwise} If si = root, then the parent pointers form a directed tree
rooted at i which spans the set of nodes with s ≠ idle If si = idle, then sj = idle for all j and all channels are
empty
Proof Outline (1)
The Dijkstra-Scholten algorithm detects termination for a diffusing algorithm A Lemma implies that if root announces
termination, then A is quiescent Must show liveness property
If A becomes quiescent, then the root eventually announces termination
Proof Outline (2)
Proof by contradiction: Assume that A becomes quiescent and no done
event occurs After this point, no A messages are sent or
received again The tree cannot grow The tree must eventually stop shrinking Eventually, there are no further ack messages in the
global state
Proof Outline (3)
j,k, deficit(k)j = 0 + 0 + 0 + {1 if pk = j, 0
otherwise} This means that the cleanup action is
enabled The tree can shrink further -- Contradiction
Complexity Analysis
Messages 2m, where m is the number of messages sent
by the algorithm A
Time O(m(l+d))
l is an upper bound on time associated with a process performing a task
d is an upper bound on time associated with a channel to perform a task
Conclusions
Use a monitoring algorithm to detect termination of a computation
Use a spanning tree to track nodes participating in the computation
Use acks and message counters to maintain tree