Logical Time and Logical Clocks

Slides:



Advertisements
Similar presentations
Last Class: Clock Synchronization
Advertisements

Slides for Chapter 11: Time and Global State
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 4 Instructor: Haifeng YU.
Time and synchronization (“There’s never enough time…”)
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
CS 582 / CMPE 481 Distributed Systems Synchronization.
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
Distributed Systems Fall 2009 Logical time, global states, and debugging.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Slides for Chapter 10: Time and Global State
Time and Global States Chapter 11. Why time? Time is an Important and interesting issue in distributes systems. One we can measure accurately. Can use.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Distributed Mutual Exclusion Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4,
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.
Lecture 9: Time & Clocks CDK4: Sections 11.1 – 11.4 CDK5: Sections 14.1 – 14.4 TVS: Sections 6.1 – 6.2 Topics: Synchronization Logical time (Lamport) Vector.
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
PHYSICAL AND LOGICAL TIME EE324 Lecture 11 Last Time– RPC  Why remote procedure calls?  Simple way to pass control and data  Elegant transparent way.
Logical Clocks (2). Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps.
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Project Reference Some slides are in courtesy of Dr. Erciyes,
Distributed Mutex EE324 Lecture 11.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
1 Causal Delivery Advanced Networks PhD. Saúl Pomares Hernández.
TIME AND GLOBAL STATES Đàm Vĩnh Tường ( ) Nguyễn Lê Anh Đào ( ) Trần Viễn Phúc ( )
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Chapter 10: Time and Global States
Logical Clocks. Topics Logical clocks Totally-Ordered Multicasting Vector timestamps.
Lamport’s Logical Clocks & Totally Ordered Multicasting.
“Virtual Time and Global States of Distributed Systems”
CSE 486/586 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
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.
Lecture 9: Time and clocks (Chap 11) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
CIS825 Lecture 2. Model Processors Communication medium.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
Logical Clocks. Topics Logical clocks Totally-Ordered Multicasting Vector timestamps.
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 582 / CMPE 481 Distributed Systems Synchronization.
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.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSC 8320 Advanced Operating System
Distributed Mutex EE324 Lecture 11.
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
Time and Clock Primary standard = rotation of earth
Logical Clocks and Casual Ordering
Time And Global Clocks CMPT 431.
Event Ordering.
Outline Theoretical Foundations
CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
ITEC452 Distributed Computing Lecture 10 Time in a Distributed System
Basics of Distributed Systems
Slides for Chapter 11: Time and Global State
Lecture 8 Processes and events Local and global states Time
Outline Theoretical Foundations - continued
Slides for Chapter 14: Time and Global States
Proof of liveness: an example
Outline Theoretical Foundations
Presentation transcript:

Logical Time and Logical Clocks Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4, Addison-Wesley 2005, Chap. 11.4 Michel Raynal, Mukesh Singhal "Capturing Causality in Distributed Systems", IEEE Computer, Febr. 1996, pp. 49-56 Distributed Systems Béat Hirsbrunner (UniFr), Peter Kropf (UniNe) and Pierre Kuonen (EiaFr) Summer Semester 2007, Lecture 2b, 30 March 2007 nfnfdnfnfn

Causality In relativity, if L causes R, then the order of L and R must be the same for all observers Woudn't this be a nice property for a distributed computer system? nfnfdnfnfn

Logical Time: Basic Observation If two events occurred at the same process pi (i = 1, 2, … N) then they occurred in the order observed by pi, that is in the order  When a message m is sent between two processes, the event of sending the message occured before the event of receiving the message: send(m)  receive(m) Fig. 11.5. Events occuring at three processes nfnfdnfnfn

Lamport's Happened-Before Relation  HB1: for any pair of events e and e’, if there is a process pi such that e i e’, then e  e’ HB2: for any pair of events e and e’ and for any message m, if e = send(m) and e’ = receive(m), then e  e’ HB3: if e, e’ and e’’ are events and if e  e’ and e’  e’’, then e  e’’ (transitivity) Remarks. HB defines only a partial order, i.e. not all events are related by the relation . Concurrency: if not (e  e’) and not (e'  e), events e and e' are concurrent, and are denoted as e || e'. HB captures only potential causality, i.e. two events can be related by  even though there is no real connection between them. nfnfdnfnfn

Lamport's Logical Clock In a system of logical clock, every process has a logical clock that is advanced using a set of rules. Lamport's logical clocks capture the happen-before relation : each process pi keeps its own clock Li. Lamport's timestamp of event e at pi is denoted by Li(e). The rules to update Li are: LC1: Li is incremented before each event at pi: Li := Li + 1. LC2a: When a process pi sends a message m, it piggybacks on m the value t := Li. LC2b: On receiving (m,t), a process pj computes Lj := max(Lj, t) and then applies LC1 before timestamping the event receive(m). nfnfdnfnfn

Example Remark 1 Note that e  e’ => L(e) < L(e'). Fig. 11.6 Remark 1 Note that e  e’ => L(e) < L(e'). Unfortunately, the inverse is not true! Remark 2 L generates only a partial order, i.e. some distincts events have numerically identical Lamport timestamps. A total order can be defined as follows: we timestamps an event e occuring at pi with local timestamp Ti by (Ti, i) and define (Ti,i) < (Tj,j) if and only if Ti < Tj or Ti = Tj and i < j. nfnfdnfnfn

Vector Clocks Vector clocks overcome the shortcoming of Lamport logical clocks: L(e) < L(e’) does not imply e happened before e’. As for Lamport's clock, each process keeps its own vector clock Vi: Vi[i] is the number of events that pi has timestamped, Vi[j], i≠j, is the number of events that have occured at pj that pi has potentially been affected to. The rules to update the vector Vi of N intergers are: VC1: Initially Vi[j] := 0 for i, j = 1, 2, …N. VC2: Just before pi timestamps an event, it sets Vi[i] := Vi[i] +1. VC3: pi piggybacks t := Vi on every message it sends. VC4: when pi receives (m,t) it sets Vi[j] := max(Vi[j] , t[j]) for all j, and then applies VC2 before timestamping the event receive(m). nfnfdnfnfn

Example Theorem: e  e’ <=> V(e) < V(e') Fig. 11.7 Vector comparison definition: V = V’ iff V[j] = V’[j] for all j V  V’ iff V[j]  V’[j] for all j V < V’ iff V  V’ and V  V’ Example: V(b) < V(d), i.e. b  d V(e) is unorded to V(d), i.e. e || d A last remark: matrix clocks have been defined, whereby processes keep estimates of other processes' times as well as their own, cf [Raynal 96]. Theorem: e  e’ <=> V(e) < V(e') nfnfdnfnfn