Hwajung Lee. Some applications - computing network topology - termination detection - deadlock detection Chandy Lamport algorithm does a partial job.

Slides:



Advertisements
Similar presentations
Global States.
Advertisements

1 Deadlock Deadlock is a situation where a process or a set of processes is blocked on an event that never occurs Processes while holding some resources.
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.
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,
Uncoordinated Checkpointing The Global State Recording Algorithm.
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
Leader Election Let G = (V,E) define the network topology. Each process i has a variable L(i) that defines the leader.  i,j  V  i,j are non-faulty.
6.852: Distributed Algorithms Spring, 2008 Class 12.
Time and Global States Part 3 ECEN5053 Software Engineering of Distributed Systems University of Colorado, Boulder.
Termination Detection of Diffusing Computations Chapter 19 Distributed Algorithms by Nancy Lynch Presented by Jamie Payton Oct. 3, 2003.
Global State Collection. Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
Distributed Snapshot (continued)
CS 582 / CMPE 481 Distributed Systems
Deadlock Detection with One Resource of Each Type (1)
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
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
UBI529 Distributed Algorithms
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?
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
Leader Election (if we ignore the failure detection part)
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.
Global State Collection
Hwajung Lee. Let G = (V,E) define the network topology. Each process i has a variable L(i) that defines the leader.   i,j  V  i,j are non-faulty ::
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.
CSE 486/586 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
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.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
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.
Global state and snapshot
Termination detection
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Consistent cut A cut is a set of events.
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.
Advanced Topics in Concurrency and Reactive Programming: Time and State Majeed Kassis.
Global state and snapshot
Lecture 3: State, Detection
Theoretical Foundations
Lecture 9: Asynchronous Network Algorithms
ITEC452 Distributed Computing Lecture 9 Global State Collection
Distributed Snapshot.
Leader Election (if we ignore the failure detection part)
Distributed Snapshot.
Global state collection
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
Global State Collection
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Distributed Snapshot Distributed Systems.
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
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.
CIS825 Lecture 5 1.
Consistent cut If this is not true, then the cut is inconsistent
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chandy-Lamport Example
Distributed Snapshot.
Presentation transcript:

Hwajung Lee

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.

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)

Program broadcast (for process i} define V.i, W.i : set of values ; initially V.i={s(i)}, W.i =   and  every channel is empty  do V.i ≠ W.i  send (V.i \ W.i) to every outgoing channel; W.i := V.i ˜  j: ¬ empty (j, i)  receive X from channel(j, i); V.i := V.i  X od 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)

Lemma. empty (i. k)  W.i  V.k. (Why?) Lemma. The algorithm will terminate in a bounded number of steps. (Why?) (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 V.k W.k (i,k)

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

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

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

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)

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)

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 if necessary, 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 engaged nodes induce a spanning tree

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

Three aspects of deadlock  deadlock detection  deadlock prevention  deadlock recovery

 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

 Represents who waits for whom.  No single process can see the WFG.  Review how the WFG is formed.

 Resource deadlock [R1 AND R2 AND R3 …] also known as AND deadlock  Communication deadlock [R1 OR R2 OR R3 …] also known as OR deadlock

Notations w(j) = true  (j is waiting) depend [j,i] = true  j  succ n (i) (n>0) P(i,s,k) is a probe (i=initiator, s= sender, r=receiver) P(4,4,3) initiator

{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

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

This WFG has a resource deadlock but no communication deadlock 5

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