Chapter 11 Detecting Termination and Deadlocks. Motivation – Diffusing computation Started by a special process, the environment environment sends messages.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Distributed Deadlocks
Chapter 13 Leader Election. Breaking the symmetry in system Similar to distributed mutual exclusion problems, the first process to enter the CS can be.
Distributed Snapshots: Determining Global States of Distributed Systems - K. Mani Chandy and Leslie Lamport.
CS3771 Today: deadlock detection and election algorithms  Previous class Event ordering in distributed systems Various approaches for Mutual Exclusion.
Handling Deadlocks n definition, wait-for graphs n fundamental causes of deadlocks n resource allocation graphs and conditions for deadlock existence n.
Optimal Termination Detection for Rings Murat Demirbas OSU.
Lecture 8: Asynchronous Network Algorithms
Uncoordinated Checkpointing The Global State Recording Algorithm.
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
Self Stabilizing Algorithms for Topology Management Presentation: Deniz Çokuslu.
Termination Detection of Diffusing Computations Chapter 19 Distributed Algorithms by Nancy Lynch Presented by Jamie Payton Oct. 3, 2003.
Lecture 7: Synchronous Network Algorithms
Chap 16. Transactions. Transactions Transaction: sequence of operations such that the entire sequence appears as one indivisible operation Indivisibility.
Chapter 18 Self-Stabilization. Introduction Self-stabilization: Tolerate ‘data faults’  Example: Parent pointers in a spanning tree getting corrupted.
UBE529 Distributed Algorithms Self Stabilization.
Termination Detection. Goal Study the development of a protocol for termination detection with the help of invariants.
Termination Detection Part 1. Goal Study the development of a protocol for termination detection with the help of invariants.
Global State Collection. Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport.
Distributed Snapshot (continued)
CPSC 668Set 2: Basic Graph Algorithms1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
Distributed Algorithms Broadcast and spanning tree.
Chapter 4 - Self-Stabilizing Algorithms for Model Conservation4-1 Chapter 4: roadmap 4.1 Token Passing: Converting a Central Daemon to read/write 4.2 Data-Link.
Termination Detection Presented by: Yonni Edelist.
Chapter 10 Global Properties. Unstable Predicate Detection A predicate is stable if, once it becomes true it remains true Snapshot algorithm is not useful.
Chapter 14 Synchronizers. Synchronizers : Introduction Simulate a synchronous network over an asynchronous underlying network Possible in the absence.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
CIS 720 Distributed algorithms. “Paint on the forehead” problem Each of you can see other’s forehead but not your own. I announce “some of you have paint.
UBI529 Distributed Algorithms
Chapter 9 Global Snapshot. Global state  A set of local states that are concurrent with each other Concurrent states: no two states have a happened before.
Diffusing Computation. Using Spanning Tree Construction for Solving Leader Election Root is the leader In the presence of faults, –There may be multiple.
Distributed Snapshot. Think about these -- How many messages are in transit on the internet? --What is the global state of a distributed system of N processes?
Termination Detection
A correction The definition of knot in page 147 is not correct. The correct definition is: A knot in a directed graph is a subgraph with the property that.
Chapter 7 –System Model – typical assumptions underlying the study of distributed deadlock detection Only reusable resources, only exclusive access, single.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Snapshot. One-dollar bank Let a $1 coin circulate in a network of a million banks. How can someone count the total $ in circulation? If not.
Distributed and hierarchical deadlock detection, deadlock resolution
Hwajung Lee. -- How many messages are in transit on the internet? --What is the global state of a distributed system of N processes? How do we compute.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 2: Basic Graph Algorithms 1.
Global State Collection
Hwajung Lee. Some applications - computing network topology - termination detection - deadlock detection Chandy Lamport algorithm does a partial job.
1 Chapter 11 Global Properties (Distributed Termination)
Hwajung Lee. -- How many messages are in transit on the internet? --What is the global state of a distributed system of N processes? How do we compute.
Parallel and Distributed Simulation Deadlock Detection & Recovery.
Distributed Systems Lecture 6 Global states and snapshots 1.
ICS Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources 6.2 Approaches to the Deadlock Problem 6.3 A System Model –Resource Graphs –State.
Network Layer.
Termination detection
Consistent cut A cut is a set of events.
Lecture 3: State, Detection
Distributed Snapshots & Termination detection
Lecture 9: Asynchronous Network Algorithms
ITEC452 Distributed Computing Lecture 9 Global State Collection
Distributed Snapshot.
Short paths and spanning trees
Distributed Snapshot.
Global state collection
Global State Collection
Distributed Snapshot Distributed Systems.
Lecture 8: Synchronous Network Algorithms
Slides for Chapter 11: Time and Global State
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
ITEC452 Distributed Computing Lecture 8 Distributed Snapshot
Distributed Snapshot.
Network Layer.
Distributed algorithms
CIS825 Lecture 5 1.
Consistent cut If this is not true, then the cut is inconsistent
Distributed Snapshot.
Presentation transcript:

Chapter 11 Detecting Termination and Deadlocks

Motivation – Diffusing computation Started by a special process, the environment environment sends messages to some processes Each process is either active or passive passive process can become active only on receiving a message

Diffusing computation- Finding the shortest path Problem : find the shortest path from process P 0 to all other processes Each process knows only the delay of its incoming links Process P i maintains:  cost of currently known shortest path to P 0  parent of P i in the shortest path known

Diffusing computation- Finding the shortest path Coordinator P 0 starts diffusing computation by sending cost = 0 to neighbors P i on receiving a cost c from P j determines if c + cost(link between P i and P j ) is less than the current cost  If yes: update cost = c and  parent = P j

A diffusing algorithm for the shortest path public class ShortestPath extends Process { int parent = -1; int cost = -1; int edgeWeight[] = null; public ShortestPath(Linker initComm, int initCost[]) { super(initComm); edgeWeight = initCost; } public void initiate() { if (myId == Symbols.coordinator) { parent = myId; cost = 0; sendToNeighbors("path", cost); } public synchronized void handleMsg(Message m, int source, String tag) { if (tag.equals("path")) { int dist = m.getMessageInt(); if ((parent == -1) || (dist + edgeWeight[source] < cost)) { parent = source; cost = dist + edgeWeight[source]; System.out.println("New cost is " + cost); sendToNeighbors("path", cost); } }

Dijkstra and Scholten’s Algorithm A process is in a green state if it is passive and all its outgoing channels are empty, otherwise, it is in a red state. The computation has terminated if all processes are green

Dijkstra and Scholten’s Algorithm Maintain a set T such that  I0: All red processes are part of T Initially only the environment P e 2 T If P j turns P k red and P k was not in T then add P k to T Maintain a directed graph (T,E) on set T such that if P k was added to T due to P j then add an edge from P j to P k (P j s the parent of P k )  I1: The edges E form a spanning tree rooted at P e Remove P k from T and the edge to P k from E only if P k is a green leaf node

An Optimization To detect if channel is empty (to determine if the process is green) we could send a signal message (acknowledgements) for every message received Optimization: A node does send the signal message to the process that made it active until it is ready to leave the tree

public class DSTerm extends Process implements TermDetector { int state = passive; int D = 0; int parent = -1; boolean envtFlag;... public synchronized void handleMsg(Msg m, int src, String tag) { if (tag.equals("signal")) { D = D - 1; if (D == 0) { if (envtFlag) System.out.println("Termination Detected"); else if (state == passive) { sendMsg(parent, "signal"); parent = -1; } } } else { // application message state = active; if ((parent == -1) && !envtFlag) { parent = src; } else sendMsg(src, "signal"); } } public synchronized void sendAction() { D = D + 1; } public synchronized void turnPassive() { state = passive; if ((D == 0) && (parent != -1)) { sendMsg(parent, "signal"); parent = -1; } } }

Termination detection without Acknowledgements Token based algorithm Each process maintains  state: active or passive.  color: black / white white - it has not received any message since the last visit of the token  c: number of messages sent by the process minus the number of messages received

Termination detection without Acknowledgements Token  color: Records if the token has seen any black process  count: Records the sum of all c variables in a round A process P 0 is responsible for detecting termination  System has terminated if (color P 0 is white) and (it is passive) and (token is white) and (count + value c at P 0 = 0)

Locally Stable Predicates A local predicate B is locally stable if no process involved in the predicate can change its state relative to B once B holds  E.g. Predicate “the distributed computation has terminated”  E.g. A stable predicate which is not locally predicate : “There is at most one token in the system” (if generation of new tokens is not possible in the system)

Consistent Interval Computation of a consistent global state is not necessary for locally stable predicates Consistent interval:  An interval [X,Y] is a pair of cuts X,Y such that X µ Y  An interval of cuts [X,Y] is consistent if there exists a consistent cut G such that X µ G µ Y  An interval is consistent iff

Algorithm outline Repeatedly compute consistent intervals [X,Y]  If a predicate is true in cut Y and  The values of the variables in predicate B have not changed during the interval Then B is true (though X,Y may be inconsistent cuts)

Application : Deadlock Detection Model the system as a wait for graph (WFG), if P i waits for P j then there is an edge from P i to P j If the WFG has a cycle then we have a deadlock Each P i maintains  its WFG and  a bit changed i which records if its WFG has changed since the last report to the coordinator

Application : Deadlock Detection (Contd.) Coordinator P_0 requests report periodically from all processes  P_i send its WFG if changed_i is true otherwise it send the message notChanged_i If the combined WFG has a cycle P_0 requests reports from all processes again  If everyone sends notChanged then a deadlock is detected