1 Causality. 2 The “happens before” relation happens before (causes)

Slides:



Advertisements
Similar presentations
Last Class: Clock Synchronization
Advertisements

CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 6 Instructor: Haifeng YU.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 4 Instructor: Haifeng YU.
Lecture 8: Asynchronous Network Algorithms
SES Algorithm SES: Schiper-Eggli-Sandoz Algorithm. No need for broadcast messages. Each process maintains a vector V_P of size N - 1, N the number of processes.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Time and Global States Part 3 ECEN5053 Software Engineering of Distributed Systems University of Colorado, Boulder.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Minimum Spanning Trees
Logical Time Each event is assigned a logical time from a totally ordered set T The logical times for the events must respect any possible dependencies.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
CS 582 / CMPE 481 Distributed Systems
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
Group Communications Group communication: one source process sending a message to a group of processes: Destination is a group rather than a single process.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Computer Science Lecture 11, page 1 CS677: Distributed OS Last Class: Clock Synchronization Logical clocks Vector clocks Global state.
20101 Synchronization in distributed systems A collection of independent computers that appears to its users as a single coherent system.
Ordering and Consistent Cuts Presented by Chi H. Ho.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.
Cloud Computing Concepts
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Logical Clocks and Global State.
Chapter 17 Theoretical Issues in Distributed Systems
Logical Clocks (2). Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps.
Chapter 5.
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.
TreadMarks Distributed Shared Memory on Standard Workstations and Operating Systems Pete Keleher, Alan Cox, Sandhya Dwarkadas, Willy Zwaenepoel.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
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?
Logical Clocks. Topics Logical clocks Totally-Ordered Multicasting Vector timestamps.
“Virtual Time and Global States of Distributed Systems”
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
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.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 5 Instructor: Haifeng YU.
D ISTRIBUTED S YSTEM UNIT-2 Theoretical Foundation for Distributed Systems Prepared By: G.S.Mishra.
Logical Clocks. Topics r Logical clocks r Totally-Ordered Multicasting.
Event Ordering. CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CSE 486/586 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
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.
Efficient Algorithms for Distributed Snapshots and Global Virtual Time Approximation Author: Friedermann Mattern Presented By: Shruthi Koundinya.
Distributed Systems Lecture 6 Global states and snapshots 1.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Consistent cut A cut is a set of events.
Time and Global States Ali Fanian Isfahan University of Technology
Vector Clocks and Distributed Snapshots
CSE 486/586 Distributed Systems Global States
Distributed Snapshots & Termination detection
Lecture 9: Asynchronous Network Algorithms
Distributed Snapshot.
Distributed Snapshot.
湖南大学-信息科学与工程学院-计算机与科学系
Logical Clocks and Casual Ordering
Chapter 5 (through section 5.4)
ITEC452 Distributed Computing Lecture 8 Distributed Snapshot
Distributed Snapshot.
Chap 5 Distributed Coordination
CSE 486/586 Distributed Systems Global States
CSE 486/586 Distributed Systems Reliable Multicast --- 2
Consistent cut If this is not true, then the cut is inconsistent
Distributed Snapshot.
Presentation transcript:

1 Causality

2 The “happens before” relation happens before (causes)

3 A message is sent from to

4 and transitivity

5

6 “happens before” is a partial order Parallel events:

7 “happens before” is a partial order Parallel events:

8 We can move parallel events The happens before relation doesn’t change

9 We want to find a mechanism that captures the “happens before” relationship so that we use causality in various computation problems

10 Logical Clocks In each process, the logical clock increases by 1 with each local event 0 0

Logical clocks are piggy-packed on messages 4 0 0

12 Logical clocks, seem that they capture the happens before relation

Example:

14 However, logical clocks cannot capture parallelism Parallel events

15 We need another mechanism that can capture the parallelism of events

16 Vector Clocks Process entry

17 Each process increases its entry at each event increment

18 Each process increases its entry at each event increment

19 vector clocks are piggy-packed on messages The maximum of each entry

20 vector clocks are piggy-packed on messages

21 vector clocks are piggy-packed on messages

22

23 Comparison of vector clocks if for all We write

24 Examples:

25 Incomparable vector clocks We write If neither nor

26 Examples:

27 Vector clocks capture causality If then

28 If then By examining the vector clocks we can determine the order of events

29

30

31

32

33 Cuts

35 consists from an event from each process Cut:

36 no messages cross the cut Consistent cut:

37 messages can cross from left to right of the cut Consistent cut:

38 messages cross from right to left of the cut Inconsistent cut:

messages cross from right to left of the cut Inconsistent cut:

40 A consistent cut such that Maximal Consistent Cut Maximal Consistent Cut of : Consider some (inconsistent) cut and contains most recent events

41 (inconsistent cut)

42 maximal consistent cut (inconsistent cut)

43 Theorem: For every cut, there is a unique maximal consistent cut Proof:Proof by contradiction

44 Assume for contradiction there are two (or more) maximal cuts of maximal consistent cuts

45 not maximal! It cannot be that and don’t cross

46 and cross

47 and cross new cut

48 and cross impossible is consistentsince

49 and cross impossible is consistentsince

50 and cross is consistent not maximal! Contradiction! End of proof

51 A distributed algorithm for computing the maximum consistent cut of : Use vector clocks For each processor: Find most recent event with vector clock

OK

OK

OK

OK

59 Distributed Snapshot A set of processors initiate the computation for obtaining a global snapshot The cut contains the state of at least one processor in in the initiation (these processors receive special marker messages from the system)

60 A Distributed Snapshot Algorithm Upon receiving a marker message: Processor : Count local events in If then set send marker to all neighbors

62 m

63 m m m

64 m m m

65 m m m m m m m m

66 m m m m m m m m

67 m m m m m m m m m

68 m m m m m m m m m cut

69 Theorem:The cut obtained by the algorithm is consistent Proof: By contradiction

70 Suppose the cut is incosistent

71 It must be: m Impossible! End of proof (we assume FIFO)

Spring 2003Costas Busch72 FIFO-Broadcast

Spring 2003Costas Busch73 FIFO Order Messages from are received in the order they are sent from

Spring 2003Costas Busch74 Not FIFO-order

Spring 2003Costas Busch75 Messages from different processors may be received in different order FIFO order

Spring 2003Costas Busch76 Not FIFO-order

Spring 2003Costas Busch77 Why is FIFO important? Deposit $1000 ATM Bank Account Withdraw $500 $0 $1000$500 FIFO order

Spring 2003Costas Busch78 Why is FIFO important? Deposit $1000 ATM Bank Account Withdraw $500 $0 $500-$500 Not FIFO order Not an allowed transaction

Spring 2003Costas Busch79 2 A processor increments a counter when it broadcasts A simple FIFO algorithm 12

Spring 2003Costas Busch80 A processor keeps track of the highest values received from other processors

Spring 2003Costas Busch81 Wait until all messages with smaller values from the same sender are received waitok

Spring 2003Costas Busch82 receive

Spring 2003Costas Busch83 Totally Ordered - Broadcast

Spring 2003Costas Busch84 Total Order Messages are received in the same order in every processor

Spring 2003Costas Busch85 Not Total Order

Spring 2003Costas Busch86 Total Order

Spring 2003Costas Busch87 Not Total Order

Spring 2003Costas Busch88 An Asymmetric Algorithm 1 Request a counter value counter

Spring 2003Costas Busch counter Receive a counter value

Spring 2003Costas Busch counter Broadcast

Spring 2003Costas Busch counter

Spring 2003Costas Busch92 2 With the counter, broadcast messages are totally ordered 1 wait ok 2 1

Spring 2003Costas Busch93 2 With the counter, broadcast messages are totally ordered 1 wait ok received

Spring 2003Costas Busch94 A Symmetric Algorithm Builds on top of FIFO It is a form of Vector Clocks

Spring 2003Costas Busch95 Every process has a counter On broadcast: the process sends the counter value to every boby

Spring 2003Costas Busch96 On reception of a message: If received counter value is higher than local value, then: Update local counter to new value Broadcast new counter value to everybody else

Spring 2003Costas Busch97

Spring 2003Costas Busch

Spring 2003Costas Busch

Spring 2003Costas Busch Special broadcast message

Spring 2003Costas Busch

Spring 2003Costas Busch Actual reception of normal broadcast message

Spring 2003Costas Busch Another normal broadcast

Spring 2003Costas Busch104 Local vector of : receive a normal broadcast message if message’s counter is smaller or equal than each

Spring 2003Costas Busch105

Spring 2003Costas Busch

Spring 2003Costas Busch

Spring 2003Costas Busch

Spring 2003Costas Busch

Spring 2003Costas Busch Symmetry is broken with node ids

Spring 2003Costas Busch111 Casually Ordered - Broadcast

Spring 2003Costas Busch112 Casual Order Messages are received in the order they are caused

Spring 2003Costas Busch113 Not causal order

Spring 2003Costas Busch114 Casual order

Spring 2003Costas Busch115 Not casual order

Spring 2003Costas Busch116 The Total Order algorithms we described are also Casual Order algorithms Observation: There is a more efficient algorithm in terms of message complexity

Spring 2003Costas Busch117

Spring 2003Costas Busch118

Spring 2003Costas Busch119

Spring 2003Costas Busch120

Spring 2003Costas Busch121

Spring 2003Costas Busch122

Spring 2003Costas Busch123

Spring 2003Costas Busch124

Spring 2003Costas Busch125 Processor officially receives a message from with vector clock 1) All messages from smaller or equal to arrive 2) All messages from smaller than arrive When:

Spring 2003Costas Busch126 Relationship Between Broadcast Orders

Spring 2003Costas Busch127 Casual Order Casual Order does not imply Total Order a b ab ba

Spring 2003Costas Busch128 Casual Order Casual Order implies FIFO ab ab b a

Spring 2003Costas Busch129 Total Order Total Order does not imply Casual Order nor FIFO ab ab ba

Spring 2003Costas Busch130 FIFO FIFO does not imply Casual Order nor Total Order aab b a b