Issues with Clocks. Problem Lack of global time –Need to compare different events in a distributed system.

Slides:



Advertisements
Similar presentations
COS 461 Fall 1997 Time and Clocks u uses of time in distributed systems: –time-based algorithms (e.g. in security) –distributed make –gathering event traces.
Advertisements

Last Class: Clock Synchronization
Logical Clocks (2).
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.
Virtual Time “Virtual Time and Global States of Distributed Systems” Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.
Efficient Solutions to the Replicated Log and Dictionary Problems
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.
Common knowledge: application to distributed systems Caesar Ogole, Jan Gerard Gerrits, Harrie de Groot, Julius Kidubuka & Stijn Colen.
Lecture 13 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Last quiz Max: 69 / Median: 52 / Min: 24 In a box outside.
Logical Time and Logical Clocks
Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.
CS 603 Communication and Distributed Systems April 15, 2002.
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.
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.
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.
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.
Distributed Computing 5. Snapshot Shmuel Zaks ©
1 Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms Author: Ozalp Babaoglu and Keith Marzullo Distributed Systems: 526.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
Consensus and Its Impossibility in Asynchronous Systems.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Issues with Clocks. Context The tree correction protocol was based on the idea of local detection and correction. Protocols of this type are complex to.
Synchronization. Why we need synchronization? It is important that multiple processes do not access shared resources simultaneously. Synchronization in.
Lamport’s Logical Clocks & Totally Ordered Multicasting.
Vector Clock Each process maintains an array of clocks –vc.j.k denotes the knowledge that j has about the clock of k –vc.j.j, thus, denotes the clock of.
“Virtual Time and Global States of Distributed Systems”
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.
Totally Ordered Broadcast in the face of Network Partitions [Keidar and Dolev,2000] INF5360 Student Presentation 4/3-08 Miran Damjanovic
CIS825 Lecture 2. Model Processors Communication medium.
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.
Hwajung Lee. The State-transition model The set of global states = s 0 x s 1 x … x s m {s k is the set of local states of process k} S0  S1  S2  Each.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 5 Instructor: Haifeng YU.
CS603 Clock Synchronization February 4, What is Clock Synchronization? All nodes agree on time What do we mean by time? –Monotonic –Any observation.
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.
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.
Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: –Mutual exclusion.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
Distributed Systems Lecture 6 Global states and snapshots 1.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
COT 5611 Operating Systems Design Principles Spring 2012
ITEC452 Distributed Computing Lecture 5 Program Correctness
Time And Global Clocks CMPT 431.
Outline Theoretical Foundations
ITEC452 Distributed Computing Lecture 10 Time in a Distributed System
TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM
Basics of Distributed Systems
Jenhui Chen Office number:
COT 5611 Operating Systems Design Principles Spring 2014
Presentation transcript:

Issues with Clocks

Problem Lack of global time –Need to compare different events in a distributed system

Problem (Continued) Consider the problem of detecting insider trading in a stock exchange –Assume that no communication occurs outside the computer systems –Each entity is represented by a computer and they communicate among themselves –Whenever a process sends a message, it includes ALL the information it has learnt so far Lets not worry about the cost of implementing this –Each entity is required to follow the protocol you choose

Problem (Continued) Consider two events –An inside event, say e, that affects the company A –An event f, where an officer, X, of company A sells stock Question –Is it possible that X is guilty of insider trading?

Situation 1 Assume global time –Event e occurred at 8am –Event f occurred at 10am (same day) –Answer: –Event e occurred at 10am –Event f occurred at 8am (same day) –Answer:

Approach What we need is a way to define causality –Can event e affect event f? –This is defined as the happened before relation –Please do not confuse it with the English meaning of this

happened before Let a, b, c be events –An event can be a local event, send event or a receive event Definition : a  b (read as a happened before b) iff either one of the following condition is true –a and b are events on the same process and a occurred before b –a is a send event and b is the corresponding receive event –there exists event c such that a  c and c  b

Revisiting the Previous Problem Consider two events –An inside event, say e, that affects the company A –An event f, where an officer, X, of company A sells stock If e  f then X is guilty of insider trading

Logical Clocks Goal of logical clock is –Assign each event a timestamp –If e  f then the timestamp of e should be less than that of f. –To solve this, each process maintains a logical clock cl cl.j : clock value of process j cl.m : clock value of message m cl.a : clock value of event a

Program for Logical Timestamps Let a be a new event –If a is a local event at j cl.j := cl.j + 1 cl.a := cl.j –If a is a send event at j cl.j := cl.j + 1 cl.m := cl.j cl.a := cl.j –If a is a receive of message m at j cl.j := max(cl.j, cl.m) + 1 cl.a := cl.j

Properties of Logical Clocks If a  b then cl.a < cl.b

Proving Properties of Logical Clocks Theorem: At any time, the following statement is true for all events (that have occurred in the system so far) –  x, y :: x  y  cl.x < cl.y, –where x and y range over all the events, processes (latest event on the process) and messages (corresponding send event) Proof by induction Base case –No events created. Hence, trivially true –Show that whenever a new event is created

Invariant The predicate –a  b  cl.a < cl.b –Is called an invariant of the logical timestamp program. An invariant of a program is a predicate such that –If any step of the program is executed in a state where the invariant is true then the resulting state is also one where the invariant predicate is true –If the program execution starts in a state where the invariant is true then its execution is correct.

Logical Timestamps The time associated with an event is a pair, the clock and the process where the event occurred. For event a at process j, the timestamp ts.a is –ts.a = Lexicographical comparison iff x1 < y1  ( (x1 = y1)  (x2 < y2) )

Observation about Logical Clocks For any two distinct events a and b, either ts.a < ts.b  ts.b < ts.a The event timestamps form a total order.

So What? Consider two events –An inside event, say e, that affects the company A –An event f, where an officer, X, of company A sells stock Question –Is it possible that X is guilty of insider trading? Case 1 –cl.e = 8, cl.f = 10 –Answer: Case 2 –cl.e = 10, cl.f = 8 –Answer:

Problem Logical timestamps provide a partial information about causality. Extending logical timestamps for complete knowledge of causality