Download presentation
Presentation is loading. Please wait.
1
Global state collection
Chandy Lamport algorithm does a partial job. Each process collects a fragment of the global state, but these pieces have to be put together. Applications - computing network topology - termination detection - deadlock detection etc
2
A simple exercise s(i) s(j) i j s(k) s(l) k l Collect global state
via all-to-all broadcast At the end, each process will compute a set V, where V= {s(i): 0 ≤ i ≤ N-1 } s(i) s(j) i j s(k) s(l) k l
3
A simple exercise V.i W.i (i,k) V.k W.k
Program broadcast (for process i} define V.i, W.i : set of values; initially V.i={s(i)}, W.i = andevery channel is empty do V.i ≠ W.i send (V.i \ W.i) to every outgoing channel; W.i := V.i ¬ empty (k, i) receive X from channel (k, i); V.i := V.i X od V.i W.i (i,k) V.k W.k
4
Proof empty (i. k) W.i V.k. V.i W.i (i,k) V.k W.k
(Upon termination) i: V.i = W.i, and all channels are empty. So, V.i V.k. On a cyclic path, V.i = V.k must be true. Since s(i) V.i, s(i) V.k V.i W.i (i,k) V.k W.k
5
Termination detection
In a network, processes may be active or passive. Termination implies: (a) every process is passive, (b) all channels are empty, and (c) the global state of the system satisfies the desired postcondition
6
Termination detection
The progress of a computation. Notice how one process engages another process. Eventually All processes turn white - this signals termination.
7
Dijkstra-Scholten algorithm
An initiator initiates termination detection by sending a signal down the edge when it engages another node. At a “suitable time,” the recipient sends an ack back. When the initiator receives ack, it detects termination. Node j engages node k. j k j k j k
8
Dijkstra-Scholten algorithm
Deficit (e) = # of signals on e - # of ack on e For any node, C= deficit along incoming edges D= deficit along outgoing edges edges Invariant 1. (C ≥ 0) (D ≥ 0) Invariant 2. (C > 0) (D = 0) 1 2 3 4 5
9
Dijkstra-Scholten algorithm
Invariant 1. (C ≥ 0) (D ≥ 0) Invariant 2. (C > 0) (D = 0) The invariants must hold when an interim node sends an ack. So (C-1 ≥ 0) (C-1> 0 D=0) {follows from INV1 and INV2} = (C>1) (C≥1 D=0) = (C>1) (C=1 D=0) 1 2 3 4 5
10
Dijkstra-Scholten algorithm
program detect {for an internal node i} initially C=0, D=0, parent = i do m = signal (C=0) C:=1; state:= active; parent := sender m = ack D:= D-1 (C=1 D=0) state = passive send ack to parent; C:= 0; parent := i m = signal (C=1) send ack to the sender; od 1 2 3 4 5
11
Dijkstra-Scholten algorithm
The engagement edges form a spanning tree. The tree grows and shrinks. Signals are acknowledged on very-first-in-very-last-out basis Termination is detected when the initiator receives ack. 1 2 3 4 5
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.