Virtual Time Virtual Time and Global States of Distributed Systems Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.

Slides:



Advertisements
Similar presentations
© 2001 Business & Information Systems 2/e1 Chapter 1 Information Systems in Business.
Advertisements

Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
CSS434 Time and Global States
Time, Clocks, and the Ordering of Events in a Distributed System
Distributed Snapshots: Determining Global States of Distributed Systems - K. Mani Chandy and Leslie Lamport.
Global States.
Dan Deng 10/30/11 Ordering and Consistent Cuts 1.
Synchronization.
Virtual Time “Virtual Time and Global States of Distributed Systems” Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.
Lecture 8: Asynchronous Network Algorithms
Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks ©
Parallel and Distributed Simulation Global Virtual Time - Part 2.
Time Warp: Global Control Distributed Snapshots and Fossil Collection.
Uncoordinated Checkpointing The Global State Recording Algorithm.
D u k e S y s t e m s Time, clocks, and consistency and the JMM Jeff Chase Duke University.
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.
Distributed Process Management
Chapter 18 Distributed Process Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Logical Time Each event is assigned a logical time from a totally ordered set T The logical times for the events must respect any possible dependencies.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Dinesh Bhat - Advanced Systems (Some slides from 2009 class) CS 6410 – Fall 2010 Time Clocks and Ordering of events Distributed Snapshots.
1 Complexity of Network Synchronization Raeda Naamnieh.
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.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Distributed Process Management
20101 Synchronization in distributed systems A collection of independent computers that appears to its users as a single coherent system.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure 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.
Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms CS 249 Project Fall 2005 Wing Wong.
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.
Chapter 17 Theoretical Issues in Distributed Systems
Time Warp OS1 Time Warp Operating System Presenter: Munehiro Fukuda.
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.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti.
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.
1 Distributed Process Management Chapter Distributed Global States Operating system cannot know the current state of all process in the distributed.
“Virtual Time and Global States of Distributed Systems”
Distributed Systems Fall 2010 Logical time, global states, and debugging.
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.
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.
Feb 15, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements.
Event Ordering. CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CSE 486/586 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
1 Chapter 11 Global Properties (Distributed Termination)
Efficient Algorithms for Distributed Snapshots and Global Virtual Time Approximation Author: Friedermann Mattern Presented By: Shruthi Koundinya.
CS3771 Today: Distributed Coordination  Previous class: Distributed File Systems Issues: Naming Strategies: Absolute Names, Mount Points (logical connection.
11-Jun-16CSE 542: Operating Systems1 Distributed systems Time, clocks, and the ordering of events in a distributed system Leslie Lamport. Communications.
1 Written By: Adi Omari (Revised and corrected in 2012 by others) Memory Models CDP
Distributed Systems Lecture 6 Global states and snapshots 1.
Parallel and Distributed Simulation Techniques
Overview of Ordering and Logical Time
COT 5611 Operating Systems Design Principles Spring 2012
Outline Theoretical Foundations - continued Lab 1
Time And Global Clocks CMPT 431.
Basics of Distributed Systems
Outline Theoretical Foundations - continued
Chap 5 Distributed Coordination
COT 5611 Operating Systems Design Principles Spring 2014
Presentation transcript:

Virtual Time Virtual Time and Global States of Distributed Systems Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes having no shared memory, communicating by message transfer. Message delay > 0, but is not known in advance. A global observer – sees the global state at certain points in time. It can be said to take a snapshot of the global state. A local observer – (one of the processes in the system) sees the local state. Because of the asynchrony, a local observer can only gather local views to an approximate global view. This is a hard hazard for many management and control problems: Mutual exclusion, deadlock detection, distributed contracts, leader election, load sharing, checkpointing etc.

Solution Approaches 1.Simulating a synchronous system by an asynchronous one. This requires high overhead on global synchronization of each and every step. 2.Simulation of a global state. A snapshot, taken asynchronously, which is not necessarily correct for any specific point in time, but is in a way consistent with the local states of all processes. 3.A logical clock which is not global, but can be used to derive useful global information. The system works asynchronously, but the processes make sure to maintain their part of the clock.

Events An event is a change in the process state. An event happens instantly, it does not take time. A process is a sequence of events There are 3 types of events: 1.send event – causes a message to be sent 2.receive event – causes a message to be received 3.local event – only causes an internal change of state Events correspond to each other as follows: All events in the same process happen sequentially, one after the other. Each send event has a corresponding receive This allows us to define the happened before relation among events.

The Happened Before Relation We say that event e happened before event e (and denote it by e e or e < e) if one of the following properties holds: P1 P2 P3 e21 e11 e31 e22 e13 global time e12 e23 e32 e14 Program order:e13 < e14 Send-Receive: e23 < e12 Transitivity:e21 < e32 Processor Order: e precedes e in the same process Send-Receive: e is a send and e is the corresponding receive Transitivity: exists e s.t. e < e and e< e Example:

Independent/ Concurrent Events Two such diagrams are called equivalent when the happened before relation is the same in both. (When global time differs for certain events, think of processor execution as if it was a rubber band). Two events e, e are said to be independent or concurrent (denoted by e || e) if not e < e and not e < e. P1 P2 P3 e21 e11 e31 e22e23e24e25 e32e33e34 e12e13 global time

A cut C of a set of events E is the union set of the cut events set { ci } and all the events e E which precede any of the ci in program order. A cut is said to be consistent if also: e C and e<e always imply e C. If a receipt of a message is in a consistent cut – so is its sending. The opposite does not necessarily hold. Informally, a cut is consistent if when stretching the execution lines so that the cut events form a vertical line, there is no send-receive arrow which crosses the cut right to left. Cuts future past c1 P1 P2 P3 e11 e41 e42 e12 P4 e22e21 e31 c2 c3 c4 Ci are events of the cut.

Global States = Consistent Cuts If a cut is consistent then there is a real execution of the diagram in which all cut events happen at the same moment. Clearly, the view of a global observer at any point in time is necessarily consistent (a message that arrived was necessarily previously sent). Thus, a global view determines a consistent cut at any point in time. Any consistent cut may actually happen at a certain point during a real execution. It contains the local states of the processes when the cut event happens, and the set of messages that were already sent but not received. The Global Snapshot problem: Find an efficient protocol to compute consistent cuts. i.e. collect the local process states and the messages cutting the cut.

Virtual Time (Lamport, 1978) A logical clock is a function C:E T E – a set of events, C(e) timestamp of e T – a partially ordered set s.t. e<e C(e)<C(e) (the opposite not necessarily true, e.g. concurrent events.) Commonly, T=N, and there is a local clock Ci for each process Pi. The clocks perform the following protocol: 1.When a local event is executed in Pi: Ci := Ci + d (d>0) 2.Each message m, sent by event e = send(m), is time-stamped t(m) = C(e), and this timestamp is sent with the message. 3.When Pi receives a message with timestamp t: Ci: = max(Ci,t(m)) + d (d >0) Usually, d=1. However, d may change arbitrarily and dynamically (as long as it is positive), e.g., in an attempt to reflect actual time. The timestamp of e, C(e), is given after advancing the clock by d, accounted for e.

Logical Clocks Cntd. P1 P2 P3 e11e12 e13 e21e22 e31 C1=1 C1=2 C1=3 C2=1C2=2 C3=3 A problem: When the history of execution is read, only the timestamps of the events are known, and there is a loss of information: Suppose C(e) < C(e). We do know that e cannot have happened before e, so not (e<e). But we do not know whether e < e or e || e. Information whether the events are independent is lost (a global observer would know). Reason: When e and e are concurrent, then any of C(e) < C(e), C(e) < C(e), C(e) = C(e) may hold. Concurrency information is lost. Example:

A Vector Clock for a Global Observer P1 P2 P3 P cuts Vector of times as seen by a global observer

Approximating Global Vector Time Idea: lets compute for every process an approximation of the global observers vector clock. Have to show that approximation is good enough. Instead of integer clocks, each process Pi will maintain a vector clock Ci[]. Thus, timestamp C(e) of an event e at process Pi is Ci[] when e happens. The new protocol for maintaining the clocks is as follows: 1.When executing a local event in Pi: Ci[i] := Ci[i] Each message m, sent by event e = send(m), is time-stamped t(m) = C(e). 3.Upon receipt of a message m: for every j: Ci[j] := max{Ci[j],t(m)[j]} The time stamp of a received message contains information about other processes states. On receipt of a message, a process combines this information with what it already knows about the system state, and communicates it elsewhere, piggybacking on messages sent out.

Back to Example P1 P2 P3 P Vector of times as seen by a global observer C1 C2 C3 C t(m)= m m m Note: P3 receives ticking information from P2 even though they never communicate directly.

Actual Order of Independent Events not Important P1 P2 P3 P m m m What is the actual global order? Really dont Care! However global time = is impossible

An Invariant (*) Only Pi can advance his clock: Ci[i] ticks only at Pi. Thus, Pi always knows the up-to-date time of his local time. Thus, at any point in time, for any i,j, it holds that: Ci[i] >= Cj[i]

Vector Times can be Compared u and v concurrent: u happened before v: u did not happen after v: With vector times, timestamps can keep all the necessary information concerning the order of events. Claim: time stamp relations and happen before relations of corresponding events are equivalent.

Vector Times Relations Represent Order of Events Claim: for every e,e 1. C(e) < C(e) iff e < e 2. C(e) || C(e) iff e || e 3.If in addition e is known to have happened in process Pi then for every e then: C(e)[i] <= C(e)[i] iff e < e Proof: (For (1). Proofs of (2,3) are similar.) If e knows the local time of e (i.e., the vector component corresponding to the process where e happened is bigger in e than in e), then there must exist a sequence of time stamps from e to e which represents the happened before relation. If e<e then there exist a sequence of time stamps from e to e, and these time stamps monotonically grow in each component. The growth is strict in at least one component: that corresponding to es process.

Cuts Revisited Let X be a cut, {xi} cut events, a system of n processes. We say that the global time of X is tx = max(C(x1), …, C(xn)) (max is taken per entry). Example: Different cuts have same global Time However …

Different Consistent Cuts Have Different Global Times Claim: X is consistent iff tx = (C(x1)[1], …,C(xn)[n]) Proof: If X is consistent then its cut events xi can be viewed as if they occurred at the same moment. By the invariant (*) at that moment the claim holds. If X is not consistent, then there exists a message that was sent (say) from Pi after xi, and was received by Pj before xj. Let t be the timestamp on the message, then xi[i] < t[i] <= xj[i]. Thus tx > (C(x1)[1], …,C(xn)[n]).