Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.

Slides:



Advertisements
Similar presentations
Time, Clocks, and the Ordering of Events in a Distributed System
Advertisements

Synchronization.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Time and Clock Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
Ordering and Consistent Cuts Presented By Biswanath Panda.
Ordering and Consistent Cuts
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 13 Wenbing Zhao Department of Electrical and Computer Engineering.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
Lecture 13 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Last quiz Max: 69 / Median: 52 / Min: 24 In a box outside.
Ordering and Consistent Cuts Presented by Chi H. Ho.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
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.
TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM L. Lamport Computer Science Laboratory SRI International.
Logical Clocks (2). Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps.
Chapter 5.
EECS 262a Advanced Topics in Computer Systems Lecture 14 Lamport Clocks and OCC October 20 th, 2014 John Kubiatowicz Electrical Engineering and Computer.
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.
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?
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport Massachusetts Computer Associates,Inc. Presented by Xiaofeng Xiao.
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.
9/14/20051 Time, Clocks, and the Ordering of Events in a Distributed System by L. Lamport CS 5204 Operating Systems Vladimir Glina Fall 2005.
Synchronization CSCI 4900/6900. Importance of Clocks & Synchronization Avoiding simultaneous access of resources –Cooperate to grant exclusive access.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
CS603 Clock Synchronization February 4, What is Clock Synchronization? All nodes agree on time What do we mean by time? –Monotonic –Any observation.
CS 3471 CS 347: Parallel and Distributed Data Management Notes13: Time and Clocks.
CS 347Notes 121 CS 347: Parallel and Distributed Data Management Notes12: Time and Clocks Hector Garcia-Molina.
Feb 15, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements.
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.
6 SYNCHRONIZATION. introduction processes synchronize –exclusive access. –agree on the ordering of events much more difficult compared to synchronization.
Lecture 1: Logical and Physical Time with some Applications Anish Arora CSE 6333 Notes include material from Dr. Jeff Brumfield.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CS533 Concepts of Operating Systems Class 8 Time, Clocks, and the Ordering of Events in a Distributed System By Constantia Tryman.
6.2 Logical Clocks Kranthi Koya09/23/2015. Overview Introduction Lamport’s Logical Clocks Vector Clocks Research Areas Conclusion.
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.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.
John Kubiatowicz and Anthony D. Joseph
CSC 8320 Advanced Operating System
SYNCHORNIZATION Logical Clocks.
COT 5611 Operating Systems Design Principles Spring 2012
Distributed Systems CS
John Kubiatowicz Electrical Engineering and Computer Sciences
Event Ordering.
Outline Theoretical Foundations
TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM
Distributed Systems CS
Chapter 5 (through section 5.4)
Basics of Distributed Systems
Distributed Systems CS
John Kubiatowicz Electrical Engineering and Computer Sciences
CSE 542: Operating Systems
Proof of liveness: an example
COT 5611 Operating Systems Design Principles Spring 2014
Outline Theoretical Foundations
Presentation transcript:

Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport

Outline Partial Ordering Logical Clocks Total Ordering External Factors Physical Clocks Conclusions

Partial Ordering Partial Ordering : The smallest relation -> on the set of events of a system satisfying : –If a and b are events in the same process, and a comes before b, then a->b. –If a is the sending of a message by one process and b is the receipt of the same message by another process, then a->b. –If a->b and b->c then a->c. Causality –If a -> b, then event a can affect event b. –I.e. b comes after (or depends on results of) event a.

Partial Ordering Logical Concurrency (of Events) –Two events are concurrent if neither can causally affect the other. –I.e. a-->b and b-->a. Note : –a-->a. We assume that it is impossible to construct systems where an event can happen before itself. –Hence -> is an irreflexive partial ordering on the set of all events in the system.

Partial Ordering

Examples Time increases upward. P1 and P2 are causal. (within a process) P3 and Q3 are concurrent. (causally independent). [note that this is the case even though fig 1 seems to imply that Q3 occurs before P3] P1 are R4 are causally dependent. Only upon exchanging messages can we know regarding the ordering of events in the system.

Logical Clocks At this point, we are only considering only Logical Clocks. A clock is a way of assigning a number to an event. i.e. just a counter, no actual timing mechanism needed. No relation of between the counter and physical time. The “system” clock is the union of all clocks maintained by all the processes in the system.

Logical Clocks

Clock Condition :For any events a, b: –if a->b then C(a) < C(b). Converse condition need NOT hold. C1: If a and b are events in process P i, and a comes before b, then C i (a) < C i (b). C2 : If a is the sending of a message by process P i and b is the receipt of that message by process P k, then C i (a) < C k (b).

Logical Clocks In terms of “ticks”, this means that : –tick line between events of a process. –tick line between messages across processes. –tick is NOT an event. In terms of implementation, this means : –IR1 : Each process P i increments C i between any two successive events. –IR2 : If event a is the sending of a message m by process P i then the message m contains a time-stamp T m = C i (a). Upon receiving a message m, process P k sets C k greater than or equal to its present value and greater than T m.

Logical Clocks

Total Ordering Extension of Partial Ordering. Break ties using the < relation between processes. This is a way of assigning priorities to processes. Definition :If a is an event in process P i and b is an event in process P k, then a=>b if and only if either C i (a) < C k (b) or C i (a) = C k (b) and P i < P k Ordering depends on the system of clocks C i and is not unique. Only the partial ordering is uniquely determined by the system of events.

Partial v/s Total Ordering by Examples

Total Ordering Total ordering is important and useful in implementing a distributed system. Mutex example. Centralized scheduling will (may ?) not work. Distributed Algorithm. Problems : –algorithm requires active participation of all processes. (since to operate, each process needs to learn about operations of all processes). Failure of a single process will halt the system. –How to distinguish between pause and failure ?

External Factors Messages external to the system can cause anomalies.[banking example]. New System  (contains all external factors). New ordering operator :  Strong Clock Condition :For any events a, b in  : –If a  b then C(a) < C(b). The strong clock condition is not satisfied by our logical clocks. We turn to physical clocks...

Physical Clocks But physical clocks are not exactly synchronized and run at different rates (although the rate differential is extremely small). So, we need to adjust them ever so often to keep them “loosely synchronized” (I.e. keep them from drifting very far apart) atleast to a level that can allow the system to disambiguate ordering of events. Above parameters related to , the minimum time between events. Specialized rules IR1 and IR2 for physical clocks.

Conclusions Happened Before defines a Partial Ordering of events (arising from causal relationships). Giving priorities to processes can convert this to a Total Ordering. A centralized algorithm may not work. A Distributed algorithm has a “single point of failure” (process) ! Even Total Ordering can break down due to events external to the system. Physical clocks can help, but they must be “loosely synchronized” and must be reset forward when they drift far apart. Minimum time between events defines the granularity of “drift far apart”.