Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.

Slides:



Advertisements
Similar presentations
Global States and Checkpoints
Advertisements

Last Class: Clock 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
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.
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
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 Computing
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
4. Synchronization Clock synchronization
CS 582 / CMPE 481 Distributed Systems
Causality & Global States. P1 P2 P Physical Time 4 6 Include(obj1 ) obj1.method() P2 has obj1 Causality violation occurs when order.
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.
Slides for Chapter 10: Time and Global State
Computer Science Lecture 11, page 1 CS677: Distributed OS Last Class: Clock Synchronization Logical clocks Vector clocks Global state.
Time and Global States Chapter 11. Why time? Time is an Important and interesting issue in distributes systems. One we can measure accurately. Can use.
Ordering and Consistent Cuts
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.
Clock Synchronization and algorithm
Lecture 12 Synchronization. EECE 411: Design of Distributed Software Applications Summary so far … A distributed system is: a collection of independent.
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.
1 Distributed Systems CS 425 / CSE 424 / ECE 428 Global Snapshots Reading: Sections 11.5 (4 th ed), 14.5 (5 th ed)  2010, I. Gupta, K. Nahrtstedt, S.
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.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Synchronization CSCI 4900/6900. Importance of Clocks & Synchronization Avoiding simultaneous access of resources –Cooperate to grant exclusive access.
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”
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.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
D ISTRIBUTED S YSTEM UNIT-2 Theoretical Foundation for Distributed Systems Prepared By: G.S.Mishra.
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.
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.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
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.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
Vector Clocks and Distributed Snapshots
CSE 486/586 Distributed Systems Global States
Overview of Ordering and Logical Time
Logical Clocks and Casual Ordering
Time And Global Clocks CMPT 431.
Outline Theoretical Foundations
Chapter 5 (through section 5.4)
Slides for Chapter 11: Time and Global State
ITEC452 Distributed Computing Lecture 8 Distributed Snapshot
CSE 486/586 Distributed Systems Global States
Jenhui Chen Office number:
Distributed algorithms
Slides for Chapter 14: Time and Global States
Last Class: Naming Name distribution: use hierarchies DNS
Outline Theoretical Foundations
Presentation transcript:

Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s algorithm –Berkeley algorithm

Computer Science Lecture 10, page 2 CS677: Distributed OS Today: More Canonical Problems Logical clocks Causality –Vector timestamps Global state and termination detection

Computer Science Lecture 10, page 3 CS677: Distributed OS Logical Clocks For many problems, internal consistency of clocks is important –Absolute time is less important –Use logical clocks Key idea: –Clock synchronization need not be absolute –If two machines do not interact, no need to synchronize them –More importantly, processes need to agree on the order in which events occur rather than the time at which they occurred

Computer Science Lecture 10, page 4 CS677: Distributed OS Event Ordering Problem: define a total ordering of all events that occur in a system Events in a single processor machine are totally ordered In a distributed system: –No global clock, local clocks may be unsynchronized –Can not order events on different machines using local times Key idea [Lamport ] –Processes exchange messages –Message must be sent before received –Send/receive used to order events (and synchronize clocks)

Computer Science Lecture 10, page 5 CS677: Distributed OS Happened Before Relation If A and B are events in the same process and A executed before B, then A -> B If A represents sending of a message and B is the receipt of this message, then A -> B Relation is transitive: –A -> B and B -> C => A -> C Relation is undefined across processes that do not exhange messages –Partial ordering on events

Computer Science Lecture 10, page 6 CS677: Distributed OS Event Ordering Using HB Goal: define the notion of time of an event such that –If A-> B then C(A) < C(B) –If A and B are concurrent, then C(A) C(B) Solution: –Each processor maintains a logical clock LC i –Whenever an event occurs locally at I, LC i = LC i +1 –When i sends message to j, piggyback Lc i –When j receives message from i If LC j < LC i then LC j = LC i +1 else do nothing –Claim: this algorithm meets the above goals

Computer Science Lecture 10, page 7 CS677: Distributed OS Lamport’s Logical Clocks

Computer Science Lecture 10, page 8 CS677: Distributed OS Example: Totally-Ordered Multicasting Updating a replicated database and leaving it in an inconsistent state.

Computer Science Lecture 10, page 9 CS677: Distributed OS Causality Lamport’s logical clocks –If A -> B then C(A) < C(B) –Reverse is not true!! Nothing can be said about events by comparing time-stamps! If C(A) < C(B), then ?? Need to maintain causality –If a -> b then a is casually related to b –Causal delivery:If send(m) -> send(n) => deliver(m) -> deliver(n) –Capture causal relationships between groups of processes –Need a time-stamping mechanism such that: If T(A) < T(B) then A should have causally preceded B

Computer Science Lecture 10, page 10 CS677: Distributed OS Vector Clocks Each process i maintains a vector V i –V i [i] : number of events that have occurred at i –V i [j] : number of events I knows have occurred at process j Update vector clocks as follows –Local event: increment V i [I] –Send a message :piggyback entire vector V –Receipt of a message: V j [k] = max( V j [k],V i [k] ) Receiver is told about how many events the sender knows occurred at another process k Also V j [i] = V j [i]+1 Exercise: prove that if V(A)<V(B), then A causally precedes B and the other way around.

Computer Science Lecture 10, page 11 CS677: Distributed OS Global State Global state of a distributed system –Local state of each process –Messages sent but not received (state of the queues) Many applications need to know the state of the system –Failure recovery, distributed deadlock detection Problem: how can you figure out the state of a distributed system? –Each process is independent –No global clock or synchronization Distributed snapshot: a consistent global state

Computer Science Lecture 10, page 12 CS677: Distributed OS Global State (1) a)A consistent cut b)An inconsistent cut

Computer Science Lecture 10, page 13 CS677: Distributed OS Distributed Snapshot Algorithm Assume each process communicates with another process using unidirectional point-to-point channels (e.g, TCP connections) Any process can initiate the algorithm –Checkpoint local state –Send marker on every outgoing channel On receiving a marker –Checkpoint state if first marker and send marker on outgoing channels, save messages on all other channels until: –Subsequent marker on a channel: stop saving state for that channel

Computer Science Lecture 10, page 14 CS677: Distributed OS Distributed Snapshot A process finishes when –It receives a marker on each incoming channel and processes them all –State: local state plus state of all channels –Send state to initiator Any process can initiate snapshot –Multiple snapshots may be in progress Each is separate, and each is distinguished by tagging the marker with the initiator ID (and sequence number) A C B M M

Computer Science Lecture 10, page 15 CS677: Distributed OS Snapshot Algorithm Example a)Organization of a process and channels for a distributed snapshot

Computer Science Lecture 10, page 16 CS677: Distributed OS Snapshot Algorithm Example b)Process Q receives a marker for the first time and records its local state c)Q records all incoming message d)Q receives a marker for its incoming channel and finishes recording the state of the incoming channel