Clock Synchronization. Problem 5:33 5:57 5:20 4:53 6:01.

Slides:



Advertisements
Similar presentations
Lecture 1: Logical, Physical & Casual Time (Part 2) Anish Arora CSE 763.
Advertisements

COS 461 Fall 1997 Group Communication u communicate to a group of processes rather than point-to-point u uses –replicated service –efficient dissemination.
Fault Tolerance. Basic System Concept Basic Definitions Failure: deviation of a system from behaviour described in its specification. Error: part of.
Impossibility of Distributed Consensus with One Faulty Process
Gossip and its application Presented by Anna Kaplun.
Time and Clock Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
Computer Science 425 Distributed Systems CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
L-8 Synchronizing Physical Clocks 1 Announcements Proj1 checkpoint – due midnight tonight HW1 checkpoint – due 2/12 2.
4. Synchronization Clock synchronization
Time in Embedded and Real Time Systems Lecture #6 David Andrews
CS 582 / CMPE 481 Distributed Systems Synchronization.
Distributed Systems Fall 2010 Time and synchronization.
Distributed systems Module 2 -Distributed algorithms Teaching unit 1 – Basic techniques Ernesto Damiani University of Bozen Lesson 3 – Distributed Systems.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
Clock Synchronization Ken Birman. Why do clock synchronization?  Time-based computations on multiple machines Applications that measure elapsed time.
Josef WidderBooting Clock Synchronization1 The  - Model, and how to Boot Clock Synchronization in it Josef Widder Embedded Computing Systems Group
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
Josef Widder1 Why, Where and How to Use the  - Model Josef Widder Embedded Computing Systems Group INRIA Rocquencourt, March 10,
Composition Model and its code. bound:=bound+1.
Time Supriya Vadlamani. Asynchrony v/s Synchrony Last class: – Asynchrony Event based Lamport’s Logical clocks Today: – Synchrony Use real world clocks.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
1 Clock Synchronization Ronilda Lacson, MD, SM. 2 Introduction Accurate reliable time is necessary for financial and legal transactions, transportation.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Lecture 6: Introduction to Distributed Computing.
1 A Modular Approach to Fault-Tolerant Broadcasts and Related Problems Author: Vassos Hadzilacos and Sam Toueg Distributed Systems: 526 U1580 Professor:
1 System Models. 2 Outline Introduction Architectural models Fundamental models Guideline.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Parallel and Distributed Simulation Synchronizing Wallclock Time.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 8 Instructor: Haifeng YU.
1 Clock Synchronization for Wireless Sensor Networks: A Survey Bharath Sundararaman, Ugo Buy, and Ajay D. Kshemkalyani Department of Computer Science University.
CS603 Clock Synchronization February 4, What is the best we can do? Lundelius and Lynch ‘84 Assumptions: –No failures –No drift –Fully connected.
1 Time (and Global State). 3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock.
Computer Science 1 TinySeRSync: Secure and Resilient Time Synchronization in Wireless Sensor Networks Speaker: Sangwon Hyun Acknowledgement: Slides were.
Prepared By: Md Rezaul Huda Reza
Synchronization Distributed System. Why synchronization? Two sharpshooters in a multiplayer online game kill the same target. Which one gets the points?
Lecture 9: Time and clocks (Chap 11) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Sliding window protocol The sender continues the send action without receiving the acknowledgements of at most w messages (w > 0), w is called the window.
Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down,
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
SysRép / 2.5A. SchiperEté The consensus problem.
Distributed Systems Topic 5: Time, Coordination and Agreement
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.
Global Clock Synchronization in Sensor Networks Qun Li, Member, IEEE, and Daniela Rus, Member, IEEE IEEE Transactions on Computers 2006 Chien-Ku Lai.
Failure detection The design of fault-tolerant systems will be easier if failures can be detected. Depends on the 1. System model, and 2. The type of failures.
Alternating Bit Protocol S R ABP is a link layer protocol. Works on FIFO channels only. Guarantees reliable message delivery with a 1-bit sequence number.
Hwajung Lee. Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
Mean and Variance for Continuous R.V.s. Expected Value, E(Y) For a continuous random variable Y, define the expected value of Y as Note this parallels.
Fault Tolerance (2). Topics r Reliable Group Communication.
Distributed Systems Lecture 5 Time and synchronization 1.
CSE 486/586 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Unreliable Failure Detectors for Reliable Distributed Systems Tushar Deepak Chandra Sam Toueg Presentation for EECS454 Lawrence Leinweber.
Distributed Web Systems Time and Global State Lecturer Department University.
Proof of liveness: an example
Pedro Moreira CERN BE-CO-HT
Synchronizing Processes
When Is Agreement Possible
Distributed Computing
Time and Clock Primary standard = rotation of earth
Time and Clock.
Time and Clock.
Maya Haridasan April 15th
Physical clock synchronization
Presentation transcript:

Clock Synchronization

Problem 5:33 5:57 5:20 4:53 6:01

Why is this hard? Hard to set the clocks simultaneously Hardware clocks have a small drift rate Network messages have random delay This delay is unbounded Various types of faults are possible: –Process failure –Communication failure

Making it Tractable Clocks have higher resolution than needed e.g. clocks measure microseconds, but we only care about milliseconds Drift rate ρ of clock H is known ρ is very small Small bounded error in measurement allowable: (1 - ρ)(t - t’) ≤ H(t) - H(t’) ≤ (1 + ρ)(t - t’) A message is on-time if sent and delivered within maxp time units Minimum transmission time min is known

Reading a Remote Clock 5:305:33 Real time P Q 5:31 P sends “Time = ?” to Q

Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:41 5:37 Q sends “Time = 5:41” to P P sends “Time = ?” to Q Q receives “Time = ?” from P

Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:40 5:37 P sends “Time = ?” to Q 5:425:46 5:44 P receives “Time = 5:41” from Q Q sends “Time = 5:41” to P Q receives “Time = ?” from P

Reading a Remote Clock 5:305:33 Real time P Q 5:31 5:355:40 5:37 P sends “Time = ?” to Q 5:425:46 5:44 P receives “Time = 5:41” from Q Q sends “Time = 5:41” to P Q receives “Time = ?” from P P measures the roundtrip delay to be 12 = 2D

What does P know about Q? P sends “Time = ?” to Q at P(t) P receives “Time = T” from Q at P(t’) Roundtrip delay = P(t’) – P(t) = 2D Drift rate ρ for P and Q Minimum message travel time min At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)]

What does P know about Q? P sends “Time = ?” to Q at P(t) = 5:30 P receives “Time = 5:41” from Q at P(t’) = 5:42 Roundtrip delay = 12 minutes = 2D Drift rate ρ = 0.25 for P and Q Minimum message travel time min = 4 minutes At P(t’) = 5:42, Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] = ?

What does P know about Q? P sends “Time = ?” to Q at P(t) = 5:30 P receives “Time = 5:41” from Q at P(t’) = 5:42 Roundtrip delay = 12 minutes = 2D Drift rate ρ = 0.25 for P and Q Minimum message travel time min = 4 minutes At P(t’) = 5:42, Q(t’) in interval [5:41 + 4(1–.25), 5: (1 +.5) - 4(1 +.25)] = [5:44, 5:54]

P’s Best Guess For Q(t’) At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] In example: [5:44, 5:54] To P, Q(t’) could be anywhere in the interval What should P guess that Q(t’) is equal to?

P’s Best Guess For Q(t’) At P(t’), Q(t’) in interval [T + min(1 - ρ), T + 2D(1 + 2ρ) - min(1 + ρ)] In example: [5:44, 5:54] To P, Q(t’) could be anywhere in the interval What should P guess that Q(t’) is equal to? The midpoint! Q(t’) = T + D(1 + 2ρ) - minρ Q(t’) = 5:41 + 6(1 +.5) – 4(.25) = 5:49

How Precise is the Measurement? Max error e = D(1 + 2ρ) - min P wants to know Q(t’) within error ε Only guaranteed if D ≤ U where U = (1 - 2ρ)(ε + min) Then P reaches rapport with Q Pick ε such that U > min(1+ ρ) If D > U then need to try again

Time Service 5:33 5:57 5:20 4:53 6:01 Q P2 P3P1 Master Slave P4 Slave

Time Service 5:33 5:57 5:20 4:53 6:01 Q P2 P3P1 Master Slave P4 Slave All slaves try to maintain rapport with Q

How Should P Change it’s Clock? At P(t’) = 5:42, P estimates Q(t’) = 5:49 What should P do?

How Should P Change it’s Clock? At P(t’) = 5:42, P estimates Q(t’) = 5:49 What should P do? Gradually adjust clock to eventually match Q Let P(t) = H(t) + A(t)  H(t) is the value of the hardware clock  A(t) = mH(t) + N is an adjustment to P’s clock Set m and N so P(t’ + x) = Q(t’ + x)  x is the amortization parameter  m = (Q(t’) - P(t’)) / x  N = P(t’) - (1 + m)×H(t’)

Master-Slave Synchronization Slave tries up to k syncs with master Remember: rapport means D ≤ U Sync retry every W time units until rapport  W > 2U At rapport, gradually adjust according to P(t) = H(t) + A(t) Slave knows it is out of sync after k tries

Importance Reliable Clock Synchronization required for: –Synchronous Atomic Broadcast –Processor Group Membership Agreement Any distributed system needs accurate Clock Synchronization