Time This powerpoint presentation has been adapted from: 1)www.cse.buffalo.edu/~bina/cse486/.../TimeGlobalState sApr20.ppt.

Slides:



Advertisements
Similar presentations
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Advertisements

Time in Distributed Systems
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.
4. Synchronization Clock synchronization
CS 582 / CMPE 481 Distributed Systems Synchronization.
Distributed Systems Fall 2010 Time and synchronization.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
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.
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.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
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.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
CS542: Topics in Distributed Systems Diganta Goswami.
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.
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)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Time and Coordination March 13, Time and Coordination What is time? :-)  Issue: How do you coordinate distributed computers if there is no global.
Parallel and Distributed Simulation Synchronizing Wallclock Time.
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
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.
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.
Distributed Systems Concepts and Design Chapter 11: Time and Global States Steve Wallis, Raymond Ho, Bruce Hammer.
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
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 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.
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.
Distributed Computing
Distributed Systems CS
Time and Synchronization
Time and Clock Primary standard = rotation of earth
Time and Global States Ali Fanian Isfahan University of Technology
CSE 486/586 Distributed Systems Time and Synchronization
Net 435: Wireless sensor network (WSN)
Time and Clock.
Logical time (Lamport)
Distributed Systems CS
Time and Clock.
Distributed Systems CS
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Distributed Synchronization
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:

Time This powerpoint presentation has been adapted from: 1) sApr20.ppt

Contents  Introduction  Clocks, events and process states  Synchronizing physical clocks  Logical time & logical clocks

Contents  Introduction  Clocks, events and process states  Synchronizing physical clocks  Logical time & logical clocks

Time  Why time is important in distributed systems? A quantity that needs to be measured accurately to know at what time of day a particular event occurred at a particular computer is important for auditing purposes to maintain the consistency of distributed data  Introduction

Contents  Introduction  Clocks, events and process states  Synchronizing physical clocks  Logical time & logical clocks

Time  How to timestamp events in terms of their execution? Consider the following notations ϸ – A collection of N processes p i, i = 1,2,.. N (p executes on a single processor) s i – The state of p i (each p has a state, the state changed when it is executed) Actions of p i – Operations that transform p i ’s state (p executes with a series of actions. – Send or receive message between p i  Clocks, events and process states

Time e Event: occurrence of a single action Relation between the events(  i ) The series of events for a single process p e.g., e  i e` : e occurs before e` at p i history(p i ) = h i = The series of event e in process p i  Clocks, events and process states

Time  How to timestamp the events (e)? Clock in computer: Each computer has its own physical clock Is a device that counts oscillations occurring in a crystal at a definite frequency The OS reads the node’s hardware time: H i (t) » The counts of oscillation since an original point Then, scale it and add offset to produce software clock, C i (t) =  H i (t)+  » To timestamp of an event  Clocks, events and process states

Time  Computer clocks tend not to be in a perfect agreement. Clock drift Clocks count time at different rates Clock skew The instantaneous (direct) difference between the readings of any two clocks Why? Oscillators are subject to physical variations Frequency, temperature  Clocks, events and process states

Time  How to synchronize computer clocks? Use external source that provide highly accurate time Use atomic oscillator Used by International Atomic Time  Clocks, events and process states

Time  What is the international standard for time keeping? Coordinated Universal Time (UTC) Based on atomic time Time is coordinated with astronomical time UTC signal is broadcasted from land-based radio station to satellites covering many parts of the world  Clocks, events and process states

Contents  Introduction  Clocks, events and process states  Synchronizing physical clocks  Logical time & logical clocks

Time  How to know at what time of the day an event occurs? Two types of synchronization: External Internal Notations: C i : p i ’s clock I : an interval of real time  Synchronizing physical clocks

Time  External synchronization For a synchronization bound D > 0, and for a source S of UTC time, |S(t)-C i (t)| < D, for i = 1, 2, … N and for all real times t in I Clocks C i are accurate to within the bound D  Internal synchronization For a synchronization bound D > 0, |C i (t)-C j (t)| < D for i, j =1,2, … N, and for all real times t in I Clocks C i agree within the bound D  Clocks that are internally synchronized are not necessarily externally synchronized If the system ϸ is externally synchronized with a bound D, then the same system is internally synchronized with a bound of 2D.  Synchronizing physical clocks

Time  Synchronization in a synchronous system there will be a minimum time of transmission where no other processes executed at the same time and no other network traffic existed. Maximum time of transmission in synchronous mode is always set (i.e., time out is applied) Protocol Sender: send M(t) Receiver: set time to t + T trans Bounds are known in synchronous system min < T trans < max (constant) Optimum transmission time, T trans = (min+max) / 2 Receiver’s clock = t + (min+max) / 2  Synchronizing physical clocks t t+maxt +T trans t + min

Time  The common practice in distributed system is asynchronous; The factors lead to message delay are not bounded (no upper bound max) The Internet is asynchronous T trans = min + x, where x ≥ 0, the value of x is not known Methods for synchronizing clock in asynchronous distributed systems: Cristian’s method The Berkeley algorithms The Network Time Protocol  Synchronizing physical clocks

Time  Cristian’s method of synchronizing clocks Use time server Protocol m r – process p requests the time from server m t – process receives the time (t is inserted in the message) T round - process p records the round-trip (send request- get reply) Estimated time: t + T round /2  Synchronizing physical clocks m r m t p Time server,S

Time  Cristian’s method of synchronizing clocks Accuracy analysis If the minimum delay of a message transmission is min, then accuracy:  (T round /2 – min)  Synchronizing physical clocks t t +T round -min t +T round /2 t + min t +T round

Time and Global State  The Berkeley algorithms Internal synchronization using a coordinator computer (master). Other computers that their clocks need to be synchronized is known as slaves 1.The master polls the slaves’ clocks 2.The master estimates the slaves’ clocks by round- trip time 3.The master averages the slaves’ clock values 4.The master sends back to the slaves the amount that the slaves’ clocks should adjust 5.Slave adjust its clock  Synchronizing physical clocks

Time  The Network Time Protocol (NTP) An architecture for a time service and a protocol to distribute time information over the Internet Aims: External synchronization – Enable clients across the Internet to be synchronized accurately to UTC Reliability – Can survive lengthy losses of connectivity » Redundant server & redundant path between servers Scalability – Enable clients to resynchronize sufficiently frequently to offset the rates of drift found in most computers Security – Protect against interference with the time service  Synchronizing physical clocks

Time  NTP service is provided by servers located across the Internet Primary servers are connected directly to a time source, e.g. radio clock receiving UTC Secondary servers are synchronized to primary servers  Synchronizing physical clocks

Time  Network Time Protocol Architecture  Synchronizing physical clocks Note: Arrows denote synchronization control, numbers denote strata.

Source: Wikipedia

Time  3 modes of NTP synchronization: Multicast mode Intended for use on a high speed LAN One or more servers multicast the time to other servers in the LAN Low accuracy but sufficient Procedure-call mode Similar to Christian’s Higher accuracy than multicast Symmetric mode Use by the servers that supply time information in LANs The highest accuracy  Synchronizing physical clocks

Contents  Introduction  Clocks, events and process states  Synchronizing physical clocks  Logical time & logical clocks

Time  Events in a single process is ordered uniquely by times shown in the local clock  Clock is unable to be synchronized perfectly. Hence physical time is not accurate to determine the occurrence of events  Logical time and logical clocks

Time  Happened-before relation It is also sometimes known as the relation of causal ordering or potential causal ordering.  Logical time and logical clocks

Time  Logical clocks- a simple mechanism to capture HB order numerically. Known as Lamport timestamps algorithm (it is a software counter). LC1 L i is incremented before each event is issued at process p i : L i :=L i +1 LC2: (a) When a process p i sends a message m, it adjoin the value t = L i on m (b) On receiving (m,t), a process P j computes L j := max(L j, t) and then applies LC1 before timestamping the event receive(m)  Logical time and logical clocks

Time  Totally ordered logical clocks algorithm Assumption T i : local timestamp of e that is an event occurring at p i T j : local timestamp of e` that is an event occurring at p j The timestamps of two events e and e` are (T i, i), (T j, j) When (T i, i) < (T j, j), if and only if T i < T j, or T i = T j and i < j  Logical time and logical clocks

Time  Vector Clocks algorithm Each process p i keeps a vector clock V i VC1: Initially, V i [j]=0, for i, j = 1,2…, N VC2: Just before p i timestamps an event, it sets V i [i] := V i [i] +1 VC3: p i includes the value t= V i in every message it sends VC4: When p i receives a timestamp t in a message, it sets V i [j] :=max(V i [j], t[j]), for j=1,2…,N  Logical time and logical clocks

End of the Chapter…