Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.

Slides:



Advertisements
Similar presentations
Logical Clocks (2).
Advertisements

Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
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.
Distributed Systems Fall 2009 Logical time, global states, and debugging.
Lecture 13 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Last quiz Max: 69 / Median: 52 / Min: 24 In a box outside.
Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.
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.
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.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti.
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.
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.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport Massachusetts Computer Associates,Inc. Presented by Xiaofeng Xiao.
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.
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.
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.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Prof. Leonardo Mostarda University of Camerino
CSC 8320 Advanced Operating System
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
Time and Clock Primary standard = rotation of earth
Concurrent Graph Exploration with Multiple Robots
Distributed Systems CS
湖南大学-信息科学与工程学院-计算机与科学系
Logical Clocks and Casual Ordering
Outline Theoretical Foundations - continued Lab 1
Time And Global Clocks CMPT 431.
Event Ordering.
Outline Theoretical Foundations
Chien-Liang Fok Distribution Seminar Chien-Liang Fok
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
TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM
Distributed Systems CS
Chapter 5 (through section 5.4)
Basics of Distributed Systems
Logical time (Lamport)
Distributed Systems CS
CSE 486/586 Distributed Systems Global States
Jenhui Chen Office number:
Distributed algorithms
CIS825 Lecture 5 1.
CSE 486/586 Distributed Systems Logical Time
CSE 542: Operating Systems
Proof of liveness: an example
Outline Theoretical Foundations
Presentation transcript:

Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have global physical time. It is only possible to achieve an approximation of it. For many applications in distributed systems, what usually matters is not that all tasks agree on exactly the real time, but rather they agree on the order in which events occur

Synchronising Logical Clocks happens before If a and b are events in the same process, and a occurs before b, then a  b is true. If a is the event of a message being sent by one process, and b is the event of the message being received by another process, then a  b is also true. A message cannot be received before it is sent, or even at the same time that it is sent, since it takes a finite amount of time to arrive. 2

Happen before is a transitive relation if a  b and b  c, then a  c Need a way to represent time such that for every event, say a, a time value c(a) can be assigned on which all processes agree. These time values must have the property that if a  b, then c(a) < c(b). Logical clock is the device which is used to record the time for a process. The time which is assigned to an event is based on the value of the logical clock. The logical clock is a counter like variable. 3

logical clock loopforever if an event occurs in the process then assign the value of clock to the event; clock := clock + 1 endif if a message m is received then clock : = max(time(m), clock) + 1; assign the value of clock to the receiving message event endloop 4

P1 P2 A (0) Send to P2 (1) Receive from P1 (2) C (2) D (3) E (3) 5

total order Some events in different processes cannot be ordered according to the time. This is the case when the timestamps of two events from different processes are the same. In order to be able to give an order in this situation, the identifier of the processes are used. A timestamp is a pair (time, process-identifier). The identifiers of the processes are unique Assume that the timestamps for a and b are (Ta, Ida) and (Tb, Idb) respectively. a  b if Ta < Tb a  b if Ta = Tb and Ida < Idb The identifier is used to break the tie when two events from different processes have the same clock value. Totally ordered logical clock imposes an order between each pair of events in the system. 6

Partially ordered logical clock For some applications, giving an order between each event is neither necessary nor desirable. Does not express the causal relations of the events in the system. Debugging a distributed program. Partially ordered logical clock allows us to find the causal relation among the processes. The timestamp of the events in a system which uses the partially ordered logical clock is a set of timestamps. Each element in the set is a timestamp of the process which has causal relation with the process. P1 P2 (1, P1) (2, P1) (3, P1) (4, P1) (5, P1) (1, P2) (4, P2) (5, P2) crash P1 < P2 7

The following rules are used to maintain the timestamp. Let c denotes the time stamp of a process; and c(i) represents the timestamp of the process whose identifier is i. The following rules are used to maintain the timestamp. initialisation When a process starts execution, the time is initialised to an empty set. ticking Whenever a process p performs an event, it increments c(p) by one. process creation Whenever a process p creates a set of process pj,..., pm, they each inherit the current time from p; i.e. x:{j..m}. c(x) = c(p). process termination Whenever a child process terminates, the time of the parent process merges with the time of the child by maximising the counter values. sending Whenever a process p sends a message, that message carries the current value of the time. receiving Upon receiving a message, the receiving process merges its time with the time carried by the message by maximising the counter values. " 8

process s process t process r process q {} process p 9

process s process t a{(p, 1)} process r process q {} process p 10

e {(p,2)} process s process t a{(p, 1)} process r process q {} process p 11

e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 12

k {(p,1), (r,1), (t,1)} process t e {(p,2)} process s h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 13

f {(p,3), (r,1), (s,1)} i {(p,3), k {(p,1), (r,1), (s,1)} (r,1), (t,1)} e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 14

l {(p,3), (r,2), (s,1), (t,1)} f {(p,3), (r,1), (s,1)} i {(p,3), k {(p,1), (r,1), (s,1)} (r,1), (t,1)} e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 15

l {(p,3), (r,2), (s,1), (t,1)} f {(p,3), (r,1), (s,1)} i {(p,3), k {(p,1), (r,1), (s,1)} (r,1), (t,1)} b {(p, 1), (q, 1)} e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 16

c {(p,4), (q,2), l {(p,3), (r,2), (r,1), (s,1)} (s,1), (t,1)} g {(p,4), (r,1), (s, 1)} f {(p,3), (r,1), (s,1)} i {(p,3), k {(p,1), (r,1), (s,1)} (r,1), (t,1)} b {(p, 1), (q, 1)} e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 17

m {(p,5), (q,3), (r,2), (s,1), (t,1)} d {(p,4), (q,3), (r,1), (s,1)} c {(p,4), (q,2), l {(p,3), (r,2), (r,1), (s,1)} (s,1), (t,1)} g {(p,4), (r,1), (s, 1)} f {(p,3), (r,1), (s,1)} i {(p,3), k {(p,1), (r,1), (s,1)} (r,1), (t,1)} b {(p, 1), (q, 1)} e {(p,2)} process s process t h {(p,1), (r,1)} a{(p, 1)} process r process q {} process p 18

Compared with totally ordered logical clock, partially ordered logical clock is more expressive. Partially ordered logical clocks may be impractical and expensive for long-live computations. There is no upper bound on the size of the timestamp. The number of item in the timestamp set is only limited by the number of processes created at run time. 19

Review How does a totally ordered logical clock work? What is the main feature of a totally ordered logical clock? How does a partially ordered logical clock work? What is the main feature of a partially ordered logical clock? Which kind of logical time system do you need if you are required to develop an auditing system to monitor the execution of a distributed system develop a scheme for controlling the access to the shared resources in a distributed system

Further reading Leslie Lamport. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, 21:558–565, 1978. C. Fidge. Logical time in distributed computing systems. IEEE Computer, pages 28-33, July 1991