Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley 2001. Copyright © George Coulouris, Jean Dollimore, Tim.

Slides:



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

Synchronization.
Time in Distributed Systems
Clock Synchronization. Problem 5:33 5:57 5:20 4:53 6:01.
DISTRIBUTED SYSTEMS II FAULT-TOLERANT AGREEMENT Prof Philippas Tsigas Distributed Computing and Systems Research Group.
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.
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
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Exercises for Chapter 14: TIME.
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.
Slides for Chapter 10: Time and Global State
Synchronization Clock Synchronization Logical Clocks Global State Election Algorithms Mutual Exclusion.
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.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Distribuerede systemer – 5. marts 2001 Presentation based on slides by Coulouris et al.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
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.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
1 Synchronization Part 1 REK’s adaptation of Claypool’s adaptation of Tanenbaum’s Distributed Systems Chapter 5.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
PHYSICAL AND LOGICAL TIME EE324 Lecture 11 Last Time– RPC  Why remote procedure calls?  Simple way to pass control and data  Elegant transparent way.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
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.
DISTRIBUTED SYSTEMS II FAULT-TOLERANT AGREEMENT Prof Philippas Tsigas Distributed Computing and Systems Research Group.
TIME AND GLOBAL STATES Đàm Vĩnh Tường ( ) Nguyễn Lê Anh Đào ( ) Trần Viễn Phúc ( )
Chapter 10: Time and Global States
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
1 Time (and Global State). 3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock.
Distributed Systems Principles and Paradigms Chapter 05 Synchronization.
1 Chapter 7: Clock Synchronization, Coordination &Agreement.
Prepared By: Md Rezaul Huda Reza
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
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.
Synchronization CSCI 4900/6900. Importance of Clocks & Synchronization Avoiding simultaneous access of resources –Cooperate to grant exclusive access.
Lecture 9 – Time Synchronization
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 582 / CMPE 481 Distributed Systems Synchronization.
6 SYNCHRONIZATION. introduction processes synchronize –exclusive access. –agree on the ordering of events much more difficult compared to synchronization.
Hwajung Lee. Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
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
Distributed Computing
Time and Global States Ali Fanian Isfahan University of Technology
Time Synchronization and Logical Clocks
Logical time (Lamport)
Exercises for Chapter 11: TIME AND GLOBAL STATES
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Slides for Chapter 11: Time and Global State
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:

Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct use by individual teachers. It may not be included in any product or employed in any service without the written permission of the authors. Viewing: These slides must be viewed in slide show mode. Distributed Systems Course Time and clocks 11.1Introduction 11.2Clocks, events and process states 11.3Synchronizing physical clocks 11.4Logical time and logical clocks © Adapted by B. Hirsbrunner, University of Fribourg, Switzerland, 24 March 2006

Introduction We need to measure time accurately: to know the time an event occurred at a computer to do this we need to synchronize its clock with an authoritative external clock Algorithms for clock synchronization useful for concurrency control based on timestamp ordering authenticity of requests e.g. in Kerberos There is no global clock in a distributed system Chapter 11.3 discusses clock accuracy and synchronisation Logical time is an alternative It gives ordering of events - also useful for consistency of replicated data

3 Computer Clocks Each computer in a DS has its own internal clock –used by local processes to obtain the value of the current time –processes on different computers can timestamp their events –but clocks on different computers may give different times –computer clocks drift from perfect time and their drift rates differ from one another –clock drift rate: the relative amount that a computer clock differs from a perfect clock after a certain amount of time  Even if clocks on all computers in a DS are set to the same time, their clocks will eventually vary quite significantly unless corrections are applied

Clocks, events and process states  A distributed system is defined as a collection P of N processes p i, i = 1,2,… N  Each process p i has a state s i consisting of its variables (which it transforms as it executes)  Restrictions: –Processes communicate only by messages (via a network) –Each p i executes on a single processor –Processors do not share memory  Actions of processes: Send, Receive, change own state  Event: the occurrence of a single action that a process carries out as it executes e.g. Send, Receive, change state  Events at a single process p i, can be placed in a total ordering denoted by the 'happened before' relation  i between the events. i.e. e  i e’ if and only if e occurs before e’ at p i  A history of process p i: is a series of events ordered by  i : –history(p i )= h i =

5 Clocks  We have seen how to order events (happened before)  To timestamp events, use the computer’s clock  At real time, t, the OS reads the time on the computer’s hardware clock H i (t)  It calculates the time on its software clock C i (t)=  H i (t) +  –e.g. a 64 bit number giving nanoseconds since some base time  In general, the clock is not completely accurate –but if C i behaves well enough, it can be used to timestamp events at p i –Clock resolution < time interval between successive events that matter

6 Skew between computer clocks in a distributed system  Computer clocks are not generally in perfect agreement  Skew: the difference between the times on two clocks (at any instant)  Computer clocks are subject to clock drift (they count time at different rates)  Clock drift rate: the difference per unit of time from some ideal reference clock  Examples of clock drift rates –Ordinary quartz: about 1 sec in days (10 -6 secs/sec) –High precision quartz: about or secs/sec –Atomic oscillator: about secs/sec Figure 10.1

7 Coordinated Universal Time (UTC)  International Atomic Time is based on very accurate physical clocks (drift rate )  UTC is an international standard for time keeping  It is based on atomic time, but occasionally adjusted to astronomical time  It is broadcast from radio stations on land and satellite (e.g. GPS)  Computers with receivers can synchronize their clocks with these timing signals  Signals from land-based stations are accurate to about millisecond  Signals from GPS are accurate to about 1 microsecond –unfortunately GPS don't work well in buildings !

Synchronizing physical clocks  External synchronization –A computer’s clock C i is synchronized with an external authoritative time source S, so that: |S(t) - C i (t)| < D for i = 1, 2, … N and for all real times t in an interval I –The clocks C i are accurate to within the bound D  Internal synchronization –The clocks of a pair of computers are synchronized with one another so that: | C i (t) - C j (t)| < D for i = 1, 2, … N over an interval I of real time –The clocks C i and C j agree within the bound D.  Remarks –Internally synchronized clocks are not necessarily externally synchronized, as they may drift collectively –If the set of processes P is synchronized externally within a bound D, it is also internally synchronized within bound 2D

9 Clock correctness  A hardware clock, H is said to be correct if its drift rate is within a bound  > 0. (e.g secs/ sec) –This means that the error in measuring the interval between real times t and t’ is bounded:  (1 -  (t’ - t) ≤ H(t’) - H(t) ≤ (1 +  (t’ - t) (where t’>t) –Which forbids jumps in time readings of hardware clocks  Weaker condition of monotonicity –t' > t  C(t’) > C(t) –e.g. required by Unix make –can achieve monotonicity with a hardware clock that runs fast by adjusting the values of      C i (t)=  H i (t) +   A faulty clock is one that does not obey its correctness condition –crash failure - a clock stops ticking –arbitrary failure - any other failure e.g. jumps in time (e.g. 'Y2K bug' !)

Synchronization in a synchronous system  A synchronous distributed system is one in which the following bounds are defined: –the time to execute each step of a process has known lower and upper bounds –each message transmitted over a channel is received within a known bounded time: min ≤ T trans ≤ max –each process has a local clock whose drift rate from real time has a known bound  Internal synchronization in a synchronous system – One process p 1 sends its local time t to process p 2 in a message m, – p 2 could set its clock to t + T trans where T trans is the time to transmit m – T trans is unknown but min ≤ T trans ≤ max – uncertainty u = max-min. Set clock to t + (max + min)/2 then skew ≤ u/2

11 Cristian’s method (1989) for an asynchronous system m r m t p Time server,S  A time server S receives signals from a UTC source –Process p requests time in m r and receives t in m t from S –p sets its clock to t + T round /2 –Accuracy ± (T round /2 - min) :  because the earliest time S puts t in message m t is min after p sent m r.  the latest time was min before m t arrived at p  the time by S’s clock when m t arrives is in the range [t+min, t + T round - min] Figure 11.2 T round is the round trip time recorded by p min is an estimated minimum round trip time

12 Berkeley algorithm  Cristian’s algorithm failures –a single time server might fail, so they suggest the use of a group of synchronized servers –it does not deal with faulty servers  Berkeley algorithm (also 1989) –An algorithm for internal synchronization of a group of computers –A master polls to collect clock values from the others (slaves) –The master uses round trip times to estimate the slaves’ clock values –It takes an average (eliminating any above some average round trip time or with faulty clocks) –It sends the required adjustment to the slaves (better than sending the time which depends on the round trip time) –Measurements  15 computers, clock synchronization millisecs drift rate < 2x10 -5  If master fails, can elect a new master to take over (not in bounded time)