Distributed Systems Lecture 5 Time and synchronization 1.

Slides:



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

HIERARCHY REFERENCING TIME SYNCHRONIZATION PROTOCOL Prepared by : Sunny Kr. Lohani, Roll – 16 Sem – 7, Dept. of Comp. Sc. & Engg.
Distributed Computing
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.
CS6223: Distributed Systems Distributed Time and Clock Synchronization (1) Physical Time.
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.
Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2011 August 30, 2011 Lecture 3 Time and Synchronization Reading: Sections
Time and Global States Ali Fanian Isfahan University of Technology
L-8 Synchronizing Physical Clocks 1 Announcements Proj1 checkpoint – due midnight tonight HW1 checkpoint – due 2/12 2.
Distributed Systems Spring 2009
Distributed Systems Fall 2010 Time and synchronization.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
1 University of Freiburg Computer Networks and Telematics Prof. Christian Schindelhauer Wireless Sensor Networks 15th Lecture Christian Schindelhauer.
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.
Time in Distributed Systems Distributed Systems. Why Time is Important? If you work in the industry, you never have to worry about this You’ll rarely.
Clock Synchronization Ken Birman. Why do clock synchronization?  Time-based computations on multiple machines Applications that measure elapsed time.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
1 University of Freiburg Computer Networks and Telematics Prof. Christian Schindelhauer Wireless Sensor Networks 13th Lecture Christian Schindelhauer.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Lecture 9: Time & Clocks CDK4: Sections 11.1 – 11.4 CDK5: Sections 14.1 – 14.4 TVS: Sections 6.1 – 6.2 Topics: Synchronization Logical time (Lamport) Vector.
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)
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.
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.
Computer Science Lecture 9, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS Iterative versus Recursive name resolution.
1 Time (and Global State). 3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock.
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.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
Lecture 5-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) September 10, 2013 Lecture 5 Time and Synchronization.
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.
Distributed Systems CS Synchronization – Part I Lecture 8, Sep 23, 2013 Mohammad Hammoud.
Distributed Systems Topic 5: Time, Coordination and Agreement
Hwajung Lee. Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
Indranil Gupta (Indy) Topic: Time and Ordering Lecture A: Introduction and Basics Cloud Computing concepts All slides © IG.
CSE 486/586 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Page 1 Clock Synchronization: Physical Clocks Minqi Zhou Distributed Systems Except as otherwise noted, the content of this presentation.
Distributed Web Systems Time and Global State Lecturer Department University.
Topic 7: Time and Global State Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Proof of liveness: an example
Synchronizing Processes
Distributed Computing
Time and Synchronization
Time and Global States Ali Fanian Isfahan University of Technology
Lecture 5 Time and synchronization
CSE 486/586 Distributed Systems Time and Synchronization
Time and Synchronization
Net 435: Wireless sensor network (WSN)
Time and Clock.
Logical time (Lamport)
湖南大学-信息科学与工程学院-计算机与科学系
Lecture 12: Time and Ordering
Time and Clock.
Distributed Systems CS
Physical clock synchronization
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Logical time (Lamport)
Logical time (Lamport)
CSE 486/586 Distributed Systems Time and Synchronization
Logical time (Lamport)
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

Distributed Systems Lecture 5 Time and synchronization 1

Previous lecture Failure detection – Approaches – Metrics Gossip protocols 2

Motivation You want both audio and video to be synchronized when watching a movie You want to catch the 6:05 train but your clock is off my 7 minutes – What if it is late by 7 minutes? – What if it is fast by 7 minutes? 3

Cloud airline reservation system – Server A receives a client request to purchase last ticket on flight 123. – Server A timestamps purchase using local clock 9h:15m:32.45s, and logs it. Replies ok to client. – That was the last seat. Server A sends message to Server B saying “flight full.” – B enters “Flight ABC 123 full” + local clock value (which reads 9h:10m:10.11s) into its log. – Server C queries A’s and B’s logs. Is confused that a client purchased a ticket after the flight became full. May execute incorrect or unfair actions. 4 Motivation

Synchronization At any time the values of all non faulty clocks must be approximately equal (within Δ max ). There is a small bound on the amount by which a non faulty process is changed. 5

System definition A set of N distributed process Every process has a local physical clock No direct access to a shared global clock Communication between processes is message based 6

Applications At most once message delivery Cache consistency Active replication Medium access control GPS Global system for mobile communications (2 nd generation) 7

Time division multiple access Requirement: – Real-time communication using a shared medium Problem: – Collisions can arbitrarily delay messages Solution: – Synchronize clocks to determine access slots 8

Time division multiple access Synchronize clocks to determine access slots 1.Frame based data flow 2.Divide frames into slots 3.Scheduler assigns processes to slots 4.Clock synchronization: collision free schedule execution

Problem: instable clocks 10 Quartz oscillators oscillate at slightly different frequencies

Keeping time Oscillator – Pendulum – Quartz crystal CMOS – Microwave In a computer  11

Clock drifts in distributed systems 12

Clock resynchronization 13 Should we set back time?

Synchronization algorithms 14

Internal vs. external synchronization External Synchronize Δ max w.r.t. external time reference Internal Synchronize Δ max w.r.t. other system members 15 Externally synchronized clocks are also internally synchronized. The converse is not true.

Hardware vs. software synchronization Hardware (assisted) clock – Precise (e.g., phase locking) – Expensive (extra hardware needed) Attach GPS receivers to every machine Software clock – Less precise – More flexible – Cheap 16

Simple method Issue RPC to server to query for time Does not account for network or processing latency 17

Cristian’s algorithm 1989 – Flaviu Cristian Probabilistic algorithm – Only achieves synchronization if RTT << accuracy Used in low latency intranets Algorithm 1.P requests time from S connected to a UTC time source 2.P timestamps message from S and responds immediately 3.P sets time to be T + RTT/2 If min is the minimum time for one way transmission Then time at S when P receives message is [T + min, T + RTT - min] Therefore the accuracy of the algorithm is RTT/2 – min If RTT is long repeat request – Take request with smallest RTT – If non uniform RTTs  take weighted average to compute error 18

Berkeley’s algorithm 1989 – Gusella and Zatti Assumes no machine has an accurate time source For intranets Algorithm 1.Pick S using an election process 2.S polls Ps who reply with their time 3.S observes RTT and estimates its own and Ps’ times 4.S averages the clock time by ignoring outliers 5.S sends out adjustments (+/-) to each P 1.Method cancels individual time drifts 2.Initial experiments shown clocks to be 20-25ms in sync 3.P usually applies the - correction over a period of time by sowing down the clock – not to break the monotonic time property 19

Network Time Protocol (NTP) 1985 – one of the oldest Internet protocols in use Coordinates participating computers within few ms of UTC – Tens of ms over Internet – <1ms in LANs Current version is NTPv4 20

Uses a network of time servers to synchronize all processes on a network. Time servers are connected by a synchronization subnet tree. The root is in touch with UTC. Each node synchronizes its children nodes. Secondary servers, synched by the primary server Primary server, direct synch. Strata 3, synched by the secondary servers NTP

A typical client will poll 3 or more servers to sync its time Time offset and roundtrip delay: 22 T i T i-1 T i-2 T i-3 Server B Server A Time mm' Time t and t’: actual transmission times for m and m’(unknown) o: true offset of clock at B relative to clock at A o i : estimate of actual offset between the two clocks d i : estimate of accuracy of o i ; total transmission times for m and m’; d i =t+t’

NTP accuracy problem Accurate offset from a suitable sample population Solution: – Minimum filter Order m readings according to RTT Select the lowest RTT reading 23

Next lecture Global states and snapshots 24