Global State Collection. Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Global States.
1 Distributed Deadlock Fall DS Deadlock Topics Prevention –Too expensive in time and network traffic in a distributed system Avoidance.
Handling Deadlocks n definition, wait-for graphs n fundamental causes of deadlocks n resource allocation graphs and conditions for deadlock existence n.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Lecture 8: Asynchronous Network Algorithms
Program correctness The State-transition model A global state S  s 0 x s 1 x … x s m {s k = local state of process k} S0  S1  S2  … Each state transition.
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
Chapter 15 Basic Asynchronous Network Algorithms
6.852: Distributed Algorithms Spring, 2008 Class 12.
Deadlocks in Distributed Systems Ryan Clemens, Thomas Levy, Daniel Salloum, Tagore Kolluru, Mike DeMauro.
Termination Detection of Diffusing Computations Chapter 19 Distributed Algorithms by Nancy Lynch Presented by Jamie Payton Oct. 3, 2003.
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.
Operating Systems COMP 4850/CISG 5550 Deadlock Avoidance Dr. James Money.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
CompSci 143aSpring, Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources 6.2 Approaches to the Deadlock Problem 6.3 A System Model.
Operating Systems Principles Process Management and Coordination Lecture 6: Deadlocks 主講人:虞台文.
Distributed Snapshot (continued)
Jim Anderson Comp 122, Fall 2003 Single-source SPs - 1 Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph.
CPSC 668Self Stabilization1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
TCOM 501: Networking Theory & Fundamentals
Chapter 11 Detecting Termination and Deadlocks. Motivation – Diffusing computation Started by a special process, the environment environment sends messages.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Distributed process management: Distributed deadlock
CS Dept, City Univ.1 The Complexity of Connectivity in Wireless Networks Presented by LUO Hongbo.
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.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Complexity of Bellman-Ford Theorem. The message complexity of Bellman-Ford algorithm is exponential. Proof outline. Consider a topology with an even number.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
UBI529 Distributed Algorithms
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
Review for Exam 2. Topics included Deadlock detection Resource and communication deadlock Graph algorithms: Routing, spanning tree, MST, leader election.
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?
Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph. Want to compute a shortest path for each possible.
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.
Program correctness The State-transition model The set of global states = so x s1 x … x sm {sk is the set of local states of process k} S0 ---> S1 --->
Program correctness The State-transition model A global states S  s 0 x s 1 x … x s m {s k = set of local states of process k} S0  S1  S2  Each state.
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.
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.
Tree Constructions Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM.
Global State Collection
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Graph Algorithms Why graph algorithms ? It is not a “graph theory” course! Many problems in networks can be modeled as graph problems. Note that -The topology.
Hwajung Lee. Some applications - computing network topology - termination detection - deadlock detection Chandy Lamport algorithm does a partial job.
 2004 SDU 1 Lecture5-Strongly Connected Components.
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.
Termination detection
MODERN OPERATING SYSTEMS Third Edition ANDREW S
The Echo Algorithm The echo algorithm can be used to collect and disperse information in a distributed system It was originally designed for learning network.
ITEC452 Distributed Computing Lecture 9 Global State Collection
Distributed Snapshot.
Graph Algorithms Using Depth First Search
Global state collection
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
Global State Collection
Distributed Snapshot Distributed Systems.
The relation between the process and
ITEC452 Distributed Computing Lecture 8 Distributed Snapshot
Distributed deadlock Assume each process owns a few resources, and review how resources are allocated. Why deadlocks occur? - Exclusive (i.e not shared)
Distributed Snapshot.
Operating Systems Principles Process Management and Coordination Lecture 6: Deadlocks 主講人:虞台文.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Minimum Spanning Trees
Distributed Snapshot.
Presentation transcript:

Global State Collection

Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport algorithm does a partial job. Each process generates a fragment of the global state, but these pieces have to be “stitched together” to form a global state.

A simple exercise Once the pieces of a consistent global state become available, consider collecting the 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 } i k j l s(i)s(j) s(k)s(l)

All-to-all broadcast V.i W.i V.k W.k (i,k) Acts like a “pump” Assume that the topology is a strongly connected graph V.j W.j (j,i)

Proof outline Lemma. empty (i, k) ⇒ W.i ⊆  V.k. Use a simple inductive argument. (Upon termination) ∀ i: V.i = W.i, and all channels are empty. So, V.i ⊆  V.k. In a strongly connected graph, every node is in a cycle On a cyclic path, V.i = V.k must be true. Since s(i) ∈ V.i, s(i) ∈ V.k. V.i W.i V.k W.k (i,k) ik

Proof outline Lemma. The algorithm will terminate in a bounded number of steps. Consider the variant function V.i W.i V.k W.k (i,k) ik Statement 1 and Statement 2 increase Y lexicographically, until the V’s reach their largest value {s(0), s(1), s(2), …, s(n-1)}. So the algorithm terminates in a bounded number of steps. Channel states

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

Visualizing diffusing computation 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? passive active initiator

Dijkstra-Scholten algorithm 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. Node j engages node k. jk jk jk The basic scheme signal ack

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 > 0) ⋁ (D = 0)

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 > 0  D=0) {follows from INV1 and INV2} = (C > 1)  (C ≥1  D=0) = (C > 1)  (C =1  D=0)

Dijkstra-Scholten algorithm program detect {for an internal node i} initiallyC=0, D=0, parent = i do m = signal  (C=0) → C:=1; state:= active; parent := sender {Send signals to engage other nodes, or turn passive} []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 Note that the parent relation induces a spanning tree

Distributed deadlock When each process waits for some other process (to do something), a deadlock occurs. Assume each process owns a few resources. Review how resources are allocated, and how a deadlock is created. Three criteria for the occurrence of deadlock - Exclusive use of resources - Non-preemptive scheduling - Circular waiting by all (or a subset of) processes

Distributed deadlock Three aspects of deadlock – deadlock detection –deadlock prevention –deadlock recovery

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

Distributed Deadlock Prevention uses pessimistic strategies An example from banker’s problem (Dijkstra) A banker has $10,000. She approves a credit line of $6,000 to each of the three customers A, B, C. since the requirement of each is less than the available funds. 1.The customers can pay back any portion of their loans at any time. Note that no one is required to pay any part of the loan unless (s)he has borrowed up to the entire credit line. 2.However, after the customer has borrowed up to the entire credit line ($6000) (s)he must return the entire money is a finite time. 3.Now, assume that A, B, C borrowed $3000 each. The state is unsafe since there is a “potential for deadlock.” Why?

Banker’s Problem Questions for the banker Let the current allocations be A = $2000, B = $2400, $C=$ Now, if A asks for an additional $1500, then will the banker give the money immediately? 2. Instead, if B asks for $1500 then will the banker give the money immediately?

Wait-for Graph (WFG) Represents who waits for whom. No single process can see the WFG. Review how the WFG is formed. p0 p1 p2 p3 p4

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 p0p1 p2 p3 p4

Detection of resource deadlock Notations w(j) = true ⇒ (j is waiting) depend [j,i] = true ⇒ j ∈ succ n (i) (n>0) (i’s progress depends on j’s progress) P(i,s,k) is a probe (i=initiator, s= sender, r=receiver) P(4, 4, 3) initiator

Detection of resource deadlock {Program for process k} doP(i,s,k) received  w[k]  (k ≠ i)  ¬ depend[k, i] → send P(i,k,j) to each successor j; depend[k, i]:= true []P(i,s,k) received  w[k]  (k = i) → process k is deadlocked od

Observations To detect deadlock, the initiator must be in a cycle Message complexity = O(|E|) (edge-chasing algorithm) E=set of edges of the WFG

Communication deadlock This WFG has a resource deadlock but no communication deadlock 5

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 induced by a set of vertices with the property that (1) every vertex in the knot has at least outgoing edge, and (2) all outgoing edges from the vertices in the knot connect to other vertices in the knot. Thus it is impossible to leave the knot while following the directions of the edges.

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-Scholten’s termination detection algorithm