Time in Embedded and Real Time Systems Lecture #6 David Andrews

Slides:



Advertisements
Similar presentations
Causal Delivery (Thomas) Matt Guinn CS523, Spring 2006.
Advertisements

Lecture 1: Logical, Physical & Casual Time (Part 2) Anish Arora CSE 763.
Synchronization.
Time in Distributed Systems
Distributed Systems CS Synchronization Lecture 6, Sep 26, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Time and synchronization (“There’s never enough time…”)
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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
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
Distributed Systems Fall 2010 Time and synchronization.
Seven O’Clock: A New Distributed GVT Algorithm using Network Atomic Operations David Bauer, Garrett Yaun Christopher Carothers Computer Science Murat Yuksel.
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.
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.
1 University of Freiburg Computer Networks and Telematics Prof. Christian Schindelhauer Wireless Sensor Networks 13th Lecture Christian Schindelhauer.
1 CLOCK SYNCHRONIZATION " Synchronization in distributed systems is more complicated than in centralized ones because the former have to use distributed.
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.
1 Synchronization Part 1 REK’s adaptation of Claypool’s adaptation of Tanenbaum’s Distributed Systems Chapter 5.
Physical Clocks.
Add Fault Tolerance – order & time Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport Optimal Clock Synchronization T.K. Srikanth.
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.
Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,
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.
1 Clock Synchronization for Wireless Sensor Networks: A Survey Bharath Sundararaman, Ugo Buy, and Ajay D. Kshemkalyani Department of Computer Science University.
Global Time in Distributed Real-Time Systems Dr. Konstantinos Tatas.
Outline for Today Objectives: –Time and Timers Administrative details: –Talk on learning at 4 in 130 North Building –Questions?
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Distributed Systems Principles and Paradigms Chapter 05 Synchronization.
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.
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
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.
Synchronization in Distributed Systems In a single CPU system, critical regions, mutual exclusion and other synchronization problems are generally solved.
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.
Page 1 Clock Synchronization: Physical Clocks Minqi Zhou Distributed Systems Except as otherwise noted, the content of this presentation.
Proof of liveness: an example
Prof. Leonardo Mostarda University of Camerino
Distributed Computing
Time and Clock Primary standard = rotation of earth
CSE 486/586 Distributed Systems Time and Synchronization
Time and Clock Primary standard = rotation of earth
Time and Clock.
Clock Synchronization: Physical Clocks
Time and Clock.
ITEC452 Distributed Computing Lecture 10 Time in a Distributed System
Chapter 5 (through section 5.4)
Distributed Synchronization
Logical time (Lamport)
Chap 5 Distributed Coordination
CSE 486/586 Distributed Systems Time and Synchronization
Proof of liveness: an example
Last Class: Naming Name distribution: use hierarchies DNS
Outline Theoretical Foundations
Presentation transcript:

Time in Embedded and Real Time Systems Lecture #6 David Andrews

What We Will Cover Today Time and Order 1.Causal Order 2.Temporal Order 3.Delivery Order Measuring Time 1.Global Time 2.Precision/Accuracy 3.Sparse Time Clock Synchronization 1.Internal Synchronization 2.External Synchronization

Time and Order Time is relative… We can provide time ordering in different ways –Temporal (Think continuous timeline) Time period we are interested in is the duration Can develop ordering –If t a < t b, and t b < t c, then t a <t c. etc….. {T} is infinite ordered set of instants Event a takes place at an instant of time t a –Causal (directed dependency ordering) Can be used to find out “who done it”…. E 1 = the road ices E 2 = car slides on road E 1 -> E 2 However, E 2 cannot cause E 1 Causal events occur temporally –However, causal ordering focuses on cause -> effect, not time taken to occur Delivery Orders in distributed systems

Reference Clock Time is measured against a (theoretically perfect) clock called the reference clock. In actuality, the reference clock isn’t perfect ! Reference Clock (z clock) –External observers absolute time –Ideally, no error with “real world” time (Grennich or Zulu) –Frequency = f z, where 1/f z = (1 femtosecond) Quantization error not measurable Timestamping –Timestamp is value of clock for an observed event z(e) is absolute timestamp clock(e) value of system clock for event

Definitions Against Reference Clock Reference clock N k = #  ticks between two consecutive ticks of local clock 1 23 N k =10 Granularity (two definitions used in book) 1. N k in terms of #ticks 2. z(  tick i+1 ) – z(  tick i ) in terms of time

Physical Clocks Register counts up at  tick intervals –Quantization error set by frequency Linux = 10 msec  tick interval (resolution) 32 bit register encodes how much time ? 2 32 x 10 msec = sec = minutes = hrs = 497 days

Physical Clock Errors - Drift Clock Drift: the drift of a physical clock k between  tick i and  tick i+1 is frequency ratio between physical clock and reference clock at instance of  tick i.

Real Drift Rates Ideal case not real world. Clocks actually drift….

Drift rate  k i Environmental changes can affect the crystal –Drift can be plus/minus –Take absolute value –Specs usually give maximum drift rate  k max –Typical specs of  k max = to sec/sec

Effects of Drift Drift can be additive on free running clocks Fc = 10 Mhz 1/fc = If clock drifts per clock, then you can miss a cycle every 10,000 clocks !

Precision and Accuracy Granularity Clock a = 10 Granularity Clock b = 10 Offset = #  ticks difference (example shows 3) Precision = max offset Precsion  offset

Time to standardize….. International Atomic Time (TAI – Temps Atomique Internationle) –1 sec == 9,192,631,770 periods of the radiation of a specified transition of the cesium atom 133. Universal Time Coordinated (UTC) –“Wall Clock” Time based on astronomical observations –Not perfect due to earths slightly less than perfect rotation –1 sec = TAI second –However, number of seconds in an hour must be modified by leap second January 1, 1958 TAI==UTC –Since then, UTC deviated by approx. 30 seconds

Global Time In distributed systems, we assume all are operating on clocks of same frequency. –We acknowledge clocks have certain drifts –We acknowledge clocks “start” at slightly different origins…. 1.Assume all clocks are accurate within precision  1.For any two clocks, |z(  tick j i –z(  tick k i ) | <  2.Reasonableness condition: g >  1.Says all granularities are larger than max offset (Precision  ) 3.If reasonableness condition met, then |t j (e) – t k (e)| <= 1 (t:= macrotick) 4.Says Observer May See 1 clock difference between same event measured by two different local clocks. Lets see….

Global Time Event a occurs at: –Macrotick 1 node a –Macrotick 1 node b –“Simultaneous event Event b occurs at: –Macrotick 1 node a –Macrotick 2 node b

Global Time a b c d e Event a occurs at mtick 5 Event b occurs at mtick 8 Both Reported as macrotick 1 Event 21 Event Both Reported as macrotick 2 Event 32

Global Time A occurs at  tick 28 B occurs at  tick 30 Clock i reports macrotick 3 for A Clock j reports macrotick 2 for B

 /  Precedence Events are measured within , implying the same time Subsequent events must occur at least a duration of  0/1g, 0/2g no temporal order can be established 0/3g temporal order can be established 

Fundamental Limits of Time Measurement 1.Time stamps on two nodes for single event may differ by 1 tick. 1.Also, cannot impart temporal order on events that differ by only 1 tick 2.When measuring an interval (d obs ), the true duration d true is bounded by: (d obs – 2g) < d true < (d obs +2g) 3.Temporal order can be recovered by timestamps if difference >= 2 ticks 4.Temporal order can always be recovered if at least 0/3g

Internal Clock Synchronization Need to Guarantee that all clocks are within precision  Local clocks get “synch’ed” up periodically R int Convergence function  denotes offset of the time values immediately after resynchronization Drift offset max divergence of any two clocks (depends on R int and drift rate  of clock: Drift offset = 2  R int

Synchronization Criteria Ensemble of clocks can be synchronized if: –Convergence offset + drift <=  –Says best correction + allowable drift cannot wander out of precision range Need a Picture…..

Synchronization Techniques Central Master: –A node is designated master –Master sends value of time counter to all other (Slave) nodes –Slave Drift = master value – {current slave value +transit time} –Slave Corrects by drift value Distributed Synchronization –All nodes broadcast their time counter to all other nodes –Each node checks to see if within convergence criteria If not, node sleeps –All live nodes calculate correction and updates clock Different algorithms for doing this….

Global Time Jitter Assume node sends counter time to all other nodes –If delay for each node known, then correction is accurate –However, Jitter may occur Network congestion (usecs) Interrupt latencies (usecs) OS latencies (10 – 100 usecs) Application Software Latencies (500 usec – 5 msec) –Different techniques applied to reduce jitter in app layer

External Clock Synchronization Can broadcast a time message from global time server –Local clusters use previous techniques to synchronize