Logical Clocks (2). Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps.

Slides:



Advertisements
Similar presentations
Global States.
Advertisements

Last Class: Clock Synchronization
Logical Clocks (2).
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Reliable Multicast Steve Ko Computer Sciences and Engineering University at Buffalo.
CS542 Topics in Distributed Systems Diganta Goswami.
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.
Consistency and Replication (3). Topics Consistency protocols.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
Ordering and Consistent Cuts Presented By Biswanath Panda.
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Lecture 13 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Last quiz Max: 69 / Median: 52 / Min: 24 In a box outside.
Lecture 12 Synchronization. EECE 411: Design of Distributed Software Applications Summary so far … A distributed system is: a collection of independent.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.
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
Computer Science 425 Distributed Systems (Fall 2009) Lecture 5 Multicast Communication Reading: Section 12.4 Klara Nahrstedt.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Multicast Communication. Unicast vs. Multicast Multicast Whereas the majority of network services and network applications use unicast for IPC, multicasting.
Synchronization. Why we need synchronization? It is important that multiple processes do not access shared resources simultaneously. Synchronization in.
Logical Clocks. Topics Logical clocks Totally-Ordered Multicasting Vector timestamps.
Lamport’s Logical Clocks & Totally Ordered Multicasting.
Synchronization Chapter 5.
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Distributed Systems Fall 2010 Logical time, global states, and debugging.
Replication (1). Topics r Why Replication? r System Model r Consistency Models – How do we reason about the consistency of the “global state”? m Data-centric.
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
Distributed Coordination. Turing Award r The Turing Award is recognized as the Nobel Prize of computing r Earlier this term the 2013 Turing Award went.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
Logical Clocks. Topics Logical clocks Totally-Ordered Multicasting Vector timestamps.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 3471 CS 347: Parallel and Distributed Data Management Notes13: Time and Clocks.
Feb 15, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
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.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 15: Coordination.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
6.2 Logical Clocks Kranthi Koya09/23/2015. Overview Introduction Lamport’s Logical Clocks Vector Clocks Research Areas Conclusion.
Fault Tolerance (2). Topics r Reliable Group Communication.
11-Jun-16CSE 542: Operating Systems1 Distributed systems Time, clocks, and the ordering of events in a distributed system Leslie Lamport. Communications.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
Slides for Chapter 11: Coordination and Agreement From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Distributed Systems Lecture 6 Global states and snapshots 1.
Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.
CSE 486/586 Distributed Systems Reliable Multicast --- 1
CSC 8320 Advanced Operating System
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013
Distributed Systems CS
Event Ordering.
Outline Theoretical Foundations
Distributed Systems CS
Chapter 5 (through section 5.4)
Lecture 9: Ordered Multicasting
Distributed Systems CS
CSE 486/586 Distributed Systems Reliable Multicast --- 1
Outline Theoretical Foundations
Presentation transcript:

Logical Clocks (2)

Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps

Readings r Van Steen and Tanenbaum: 5.2 r Coulouris: 10.4 r L. Lamport, “Time, Clocks and the Ordering of Events in Distributed Systems,” Communications of the ACM, Vol. 21, No. 7, July 1978, pp r C.J. Fidge, “Timestamps in Message-Passing Systems that Preserve the Partial Ordering”, Proceedings of the 11 th Australian Computer Science Conference, Brisbane, pp , February 1988.

Problems with Lamport Clocks r Lamport timestamps do not capture causality. r With Lamport’s clocks, one cannot directly compare the timestamps of two events to determine their precedence relationship. m If C(a) < C(b) is not true then a  b is also not true. m Knowing that C(a) < C(b) is true does not allow us to conclude that a  b is true. m Example: In the first timing diagram, C(e) = 1 and C(b) = 2; thus C(e) < C(b) but it is not the case that e  b

Problems with Lamport Clocks r Why is this important? r For the banking example, it doesn’t matter what order operations are executed at each replica. r It only matters that all replicas execute the operations in the same order. This is total order. r Causal order is used when a message received by a process can potentially affect any subsequent message sent by that process. Those messages should be received in that order at all processes. Unrelated messages may be delivered in any order. r Do Lamport timestamps support causal order? m NO

Example Application:Bulletin Board r The Internet’s electronic bulletin board service (network news) r Users (processes) join specific groups (discussion groups). r Postings, whether they are articles or reactions, are multicast to all group members. r Could use a totally-ordered multicasting scheme. m Should be doing this?

Display from a Bulletin Board Program r Users run bulletin board applications which multicast messages r One multicast group per topic (e.g. os.interesting) r Require reliable multicast - so that all members receive messages r Ordering: Bulletin board: os.interesting Item FromSubject 23A.HanlonMach 24G.JosephMicrokernels 25A.HanlonRe: Microkernels 26T.L’HeureuxRPC performance 27M.WalkerRe: Mach end Figure Colouris total (makes the numbers the same at all sites) FIFO (gives sender order) causal (makes replies come after original message)

Example Application: Bulletin Board r A totally-ordered multicasting scheme does not imply that if message B is delivered after message A, that B is a reaction to A. r Totally-ordered multicasting is too strong in this case. r The receipt of an article precedes the posting of a reaction. r The receipt of the reaction to an article should always follow the receipt of the article.

Example Application: Bulletin Board r If we look at the bulletin board example, it is allowed to have items 26 and 27 in different order at different sites. r Items 25 and 26 may be in different order at different sites.

Problem with Lamport Clocks r The main problem is that a simple integer clock cannot order both events within a process and events in different processes. r C. Fidge developed an algorithm that overcomes this problem. r Fidge’s clock is represented as a vector [v 1,v 2,…,v n ] with an integer clock value for each process (v i contains the clock value of process i). This is a vector timestamp.

Fidge’s Algorithm r Properties of vector timestamps m v i [i] is the number of events that have occurred so far at P i m If v i [j] = k then P i knows that k events have occurred at P j

Fidge’s Algorithm r The Fidge’s logical clock is maintained as follows: Initially all clock values are set to the smallest value (e.g., 0). The local clock value is incremented at least once before each event in a process, q i.e., v q [q] = v q [q] +1 m Let v q be piggybacked on the message sent by process q to process p; We then have: For i = 1 to n do v p [i] = max(v p [i], v q [i] ); v p [p] = v p [p] + 1;

Fidge’s Algorithm r For two vector timestamps, v a and v b m v a  v b if there exists an i such that v a [i]  v b [i] m v a ≤ v b if for all i v a [i] ≤ v b [i] m v a < v b if for all i v a [i] ≤ v b [i] AND v a is not equal to v b r Events a and b are causally related if v a < v b or v b < v a.

Example P2 a b P1 c d e f g h i P3 j k l [1,0,0] [2,0,0] [3,0,0] [4,0,0] [0,1,0] [2,2,0] [2,3,2] [2,4,2] [4,5,2] [0,0,1] [0,0,2] [0,0,3]

Causality and Modified Vector Timestamps r What I just presented is the original Fidge’s vector timestamp. r With a slight adjustment, vector timestamps can be used to guarantee causal message delivery. r We will illustrate this adjustment, the definition of causality and the motivation through an example.

Example Application: Bulletin Board r Vector timestamps can be used to guarantee causal message delivery. r Each process P i has an array V i where V i [j] denotes the number of events that process P i knows have taken place for P j. m In this application “events” refers to the sending of a message. m Thus if V i [j] = 6 then P i knows that P j has sent 6 messages.

Example Application: Bulletin Board r Vector timestamps are assumed to be updated only when posting or receiving articles i.e., when a message is sent or received. r Let V q be piggybacked on the message sent by process P q to process P p ; When process P p receives the message, then P p does the following: For i = 1 to n do V p [i] = max(V p [i], V q [i] ); Thus if process q knows that process i sent 5 messages (V q [i] =5 and V p [i] = 3) then process p didn’t know about the latest two messages sent by process i.

Example Application: Bulletin Board r When p sends a message, it does the following: V p [p] = V p [p] + 1; r This is basically saying that the number of messages process p has sent is incremented by one.

Example Application: Bulletin Board r When a process P i posts (sends) an article, it multicasts that article with timestamp V i r Process P j posts a reaction. Let’s call this message r. Assume that the value of the timestamp is V j r Note that V j > V i r Message r may arrive at P k before message a. r P k will postpone delivery of r to the display of the bulletin board until all messages that causally precede r have been received as well.

Example Application: Bulletin Board r Message r (from P j ) is delivered to P k iff the following conditions are met: m V j [j] = V k [j]+1 This condition is satisfied if r is the next message that P k was expecting from process P j Assume that V k [j]=5. This means that P k knows P j sent 5 messages and that it should be waiting for the 6 th message. If V j [j] = 8 then messages 6,7 are lost. m V j [i] ≤ V k [i] for all i not equal to j This condition is satisfied if P k has seen at least as many messages as seen by P j when it sent message r. Assume for some i that V j [i] = 2 and V k [i] =1 and thus V j [i] > V k [i] for some i. This indicates that P i sent a message that was received by P j but not P k

Example Application: Bulletin Board P2 a P1 c d P3 e g [1,0,0] [1,0,1] Post a r: Reply a Message a arrives at P2 before the reply r from P3 does b [1,0,1] [0,0,0]

Example Application: Bulletin Board P2 a P1P3 d g [1,0,0] [1,0,1] Post a r: Reply a Buffered c [1,0,0] The message a arrives at P2 after the reply from P3; The reply is not delivered right away. b [1,0,1] [0,0,0] Deliver r

Summary r No notion of a globally shared clock. r Local (physical) clocks must be synchronized based on algorithms that take into account network latency. r Knowing the absolute time is not necessary. r Logical clocks can be used for ordering purposes.