Event Ordering. CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of.

Slides:



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

Last Class: Clock Synchronization
Logical Clocks (2).
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.
SES Algorithm SES: Schiper-Eggli-Sandoz Algorithm. No need for broadcast messages. Each process maintains a vector V_P of size N - 1, N the number of processes.
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.
Theoretical Aspects Logical Clocks Causal Ordering
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
Ordering and Consistent Cuts Presented By Biswanath Panda.
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.
Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.
1 Distributed Process Management: Distributed Global States and Distributed Mutual Exclusion.
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
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.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Project Reference Some slides are in courtesy of Dr. Erciyes,
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.
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.
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”
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.
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.
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
CS603 Clock Synchronization February 4, What is Clock Synchronization? All nodes agree on time What do we mean by time? –Monotonic –Any observation.
Distributed Systems Topic 5: Time, Coordination and Agreement
D ISTRIBUTED S YSTEM UNIT-2 Theoretical Foundation for Distributed Systems Prepared By: G.S.Mishra.
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.
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.
IMPLEMENTATION OF LAMPORT’S SCALAR CLOCKS Surekha Busa.
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.
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
Distributed Systems CS
Outline Theoretical Foundations - continued Vector clocks - review
Logical Clocks and Casual Ordering
Outline Theoretical Foundations - continued Lab 1
Event Ordering.
Outline Theoretical Foundations
CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
Distributed Systems CS
Chapter 5 (through section 5.4)
Basics of Distributed Systems
Outline Theoretical Foundations - continued
Distributed Systems CS
Distributed algorithms
CSE 542: Operating Systems
Outline Theoretical Foundations
Presentation transcript:

Event Ordering

CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of shared memory absence of a global clock We will study: how programming mechanisms change as a result of these differences algorithms that operate in the absence of a global clock algorithms that create a sense of a shared, global time algorithms that capture a consistent state of a system in the absence of shared memory

Event Ordering CS 5204 – Operating Systems3 Event Ordering How can the events on P be related to the events on Q? Which events of P “happened before” which events of Q? Partial answer: events on P and Q are strictly ordered. So: P 1 ­­> P 2 ­­> P 3 and Q 1 ­­> Q 2 ­­> Q 3 Q P P1P1 Q1Q1 P3P3 P2P2 Q3Q3 Q2Q2

Event Ordering CS 5204 – Operating Systems4 Event Ordering Realization: the only events on P that can causally affect events on Q are those that involve communication between P and Q. If P 1 is a send event and Q 2 is the corresponding receive event then it must be the case that: P 1 ­­> Q 2 Q P P1P1 Q1Q1 P3P3 P2P2 Q3Q3 Q2Q2 Message

Event Ordering CS 5204 – Operating Systems5 Event Ordering “Happened Before” relation: If E i and E j are two events of the same process, then E i ­­> E j if i < j. If E i and E j are two events of different processes, then E i ­­> E j if E i is a message send event and E j is the corresponding message receive event. The relation is transitive. Q P P1P1 Q1Q1 P3P3 P2P2 Q3Q3 Q2Q2 Message

Event Ordering CS 5204 – Operating Systems6 Lamport's Algorithm Lamport's algorithm is based on two implementation rules that define how each process's local clock is incremented. Notation: the processes are named P i, each process has a local clock, C i the clock time for an event a on process P i is denoted by C i (a). Rule 1: If a and b are two successive events in P i and a ­­> b then C i (b) = C i (a) + d where d > 0. Rule 2: If a is a message send event on P i and b is the message receive event on P j then: the message is assigned the timestamp t m = C i (a) C j (b) = max ( C j, t m +d)

Event Ordering CS 5204 – Operating Systems7 Example of Lamport’s Algorithm P1P1 P2P2 P3P

Event Ordering CS 5204 – Operating Systems8 Limitation of Lamport's Algorithm In Lamport's algorithm two events that are causally related will be related through their clock times. That is: If a --> b then C(a) < C(b) However, the clock times alone do not reveal which events are causally related. That is, if C(a) b or not. All that is known is: if C(a) a It would be useful to have a stronger property - one that guarantees that a --> b iff C(a) < C(b) This property is guaranteed by Vector Clocks.

Event Ordering CS 5204 – Operating Systems9 Vector Clock Rules Each process P i is equipped with a clock C i which is an integer vector of length n. C i (a) is referred to as the timestamp event a at P i C i [i], the ith entry of C i corresponds to P i ’s on logical time. C i [j], j  i is P i ’s best guess of the logical time at P j Implementation rules for vector clocks: [IR1] Clock C i is incremented between any two successive events in process P i C i [i] := C i [i] + d(d > 0) [IR2] If event a is the sending of the message m by process P i, then message m is assigned a vector timestamp t m = C i (a); on receiving the same message m by process P j, C j is updated as follows:  k, C j [k] := max(C j [k], t m [k])

Event Ordering CS 5204 – Operating Systems10 Vector Clocks P2P2 P1P1 (1,0,0) (0,1,0) (3,4,1) (2,0,0) (2,4,1) (2,2,0) (2,3,1) P3P3 (0,0,2) (0,0,1)

Event Ordering CS 5204 – Operating Systems11 Causal Ordering of Messages P2P2 P1P1 Send(M 1 ) Send(M 2 ) P3P3   Space Time

Event Ordering CS 5204 – Operating Systems12 Birman-Schiper-Stephenson Protocol 1. Before broadcasting a message m, a process P i increments the vector time VT Pi [i] and timestamps m. Note that (VT Pi [i] - 1) indicates how many messages from P i precede m. 2. A process P j  P i, upon receiving message m timestamped VT m from P i, delays its delivery until both the following conditions are satisfied. a. VT Pj [i] = VT m [i] - 1 b. VT Pj [k]  VT m [k]  k  {1,2,….,n} - {i} where n is the total number of processes. Delayed messages are queued at each process in a queue that is sorted by vector time of the messages. Concurrent messages are ordered by the time of their receipt. 3. When a message is delivered at a process P j, VT Pj is updated according to the vector clocks rule [IR2]