3.7. Clock Synch hronisation



Similar documents
Clock Synchronization

Synchronization in. Distributed Systems. Cooperation and Coordination in. Distributed Systems. Kinds of Synchronization.

Clock Synchronization

Distributed Synchronization

Homework 1 (Time, Synchronization and Global State) Points

Distributed Systems Theory 6. Clock synchronization - logical vs. physical clocks. November 9, 2009

Computer Time Synchronization

The Role of Precise Timing in High-Speed, Low-Latency Trading

Time Calibrator Fountain Computer Products

IP - The Internet Protocol

Computer Time Synchronization

Precision Time Protocol (PTP/IEEE-1588)

IEEE-1588 Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems

Table of Contents. Cisco Network Time Protocol: Best Practices White Paper

Choosing the correct Time Synchronization Protocol and incorporating the 1756-TIME module into your Application

Clocks/timers, Time, and GPS

Time Synchronization & Timekeeping

Precision Time Protocol on Linux ~ Introduction to linuxptp

Clock Synchronization

T200, PTP/IEEE 1588 Grandmaster Clock and

Wide Area Monitoring, Control, and Protection

Clocking. Clocking in the Digital Network

Evaluating the Accuracy of Maxim Real-Time Clocks (RTCs)

Welcome. People Power Partnership PROFIdag 2013 Peter Van Passen Sales & Business Development Manager HARTING Electric 1/44

Ethernet Port Quick Start Manual

Internet Timekeeping Around the Globe 1,2

Route Discovery Protocols

RARP: Reverse Address Resolution Protocol

CONTROL MICROSYSTEMS DNP3. User and Reference Manual

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

ECE 358: Computer Networks. Homework #3. Chapter 5 and 6 Review Questions 1

Introduction to Distributed Systems

Chapter 6: distributed systems

Clock Synchronization: Overview and Outlook

Securing GNSS with PTP & SyncE Adam Wertheimer Microsemi Adam.Wertheimer@microsemi.com. Power Matters

Precision Clock Synchronization

1 Organization of Operating Systems

LAN Switching Computer Networking. Switched Network Advantages. Hubs (more) Hubs. Bridges/Switches, , PPP. Interconnecting LANs

The basic mode for adjusting a time zone clock are primarily: 21, 24 and 51-1 (51-1 is for Alpha Characters) Entering Mode Programming

Using Network Time Protocol (NTP): Introduction and Recommended Practices

Swiss Time Systems. The new multipurpose time server for the LAN and NTP-based Distributed Time System. by MOBATIME DTS 4138.

Objectives. The Role of Redundancy in a Switched Network. Layer 2 Loops. Broadcast Storms. More problems with Layer 2 loops

VoIP Timing and Synchronization Best Practices

2. What is the maximum value of each octet in an IP address? A. 128 B. 255 C. 256 D. None of the above

CSC 774 Advanced Network Security. Outline. Related Work

IP Multicasting. Applications with multiple receivers

Transport Layer Protocols

Indoor / Outdoor Antenna

Chapter 1 Introduction to Network Maintenance Objectives

Lecture 15. IP address space managed by Internet Assigned Numbers Authority (IANA)

Internet Time Synchronization: the Network Time Protocol

IT 3202 Internet Working (New)

GPS NTP Time Server for Intranet Networks DIN RAIL Version

GPS NTP TIME SERVER Rack Version V2

Best Practices for Leap Second Event Occurring on 30 June 2015

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Multicast (Group) Addresses for Layer 2 (Ethernet) Transport of IEEE 1588 PTP Messages, with Application to AVB

LANs. Local Area Networks. via the Media Access Control (MAC) SubLayer. Networks: Local Area Networks

1 Synchronizing Windows computers

Domain Time II. Time Synchronization Software Suite Precise Time Synchronization for the Entire Enterprise

Network Time Protocol (NTP) General Overview

building scalable NTP server infrastructures

Ethernet. Ethernet. Network Devices

ACCESS 9340 and 9360 Meter Ethernet Communications Card ETHER

Protocols and Architecture. Protocol Architecture.

Real Time Programming: Concepts

TAC Virtualizing a Windows Active Directory Domain Infrastructure. Chris Skinner Technical Instructor Education Services VMware, Inc.

Monitoring the NTP Server. eg Enterprise v6.0

PHASOR MEASUREMENT UNIT (PMU) AKANKSHA PACHPINDE

In-Vehicle Networking

Routing with OSPF. Introduction

RFC 1129 Network Time Synchronization October 1989

Computer Time Synchronization Concepts

Timer, Interrupt, Exception in ARM

Dr Markus Hagenbuchner CSCI319. Distributed Systems

GS510TP and GS110T Gigabit Smart Switches

Network Layer: Network Layer and IP Protocol

Network File System (NFS) Pradipta De

NTP Precision Time Synchronization

CSMA/CA. Information Networks p. 1

(Refer Slide Time: 02:17)

2. NTP Security Model and Authentication Scheme

DATE AND TIME FOR NINE MILLION JAVA DEVELOPERS

Industrial Ethernet How to Keep Your Network Up and Running A Beginner s Guide to Redundancy Standards

VisorALARM-Manager Application Quick Guide. (Ver. 1.3) Dm 380-I. V:3.0

SFWR 4C03: Computer Networks & Computer Security Jan 3-7, Lecturer: Kartik Krishnan Lecture 1-3

Time Synchronization of Computer in secure manner while using Teleclock & NTP Services

Objectives of Lecture. Network Architecture. Protocols. Contents

Final for ECE374 05/06/13 Solution!!

TOP Server DNP 3.0 Suite. Background & Best Practices

Contents. Connection Guide. What is Dante? Connections Network Set Up System Examples Copyright 2015 ROLAND CORPORATION

Technical Bulletin. Enabling Arista Advanced Monitoring. Overview

Network Time Management Configuration. Content CHAPTER 1 SNTP CONFIGURATION CHAPTER 2 NTP FUNCTION CONFIGURATION

Transcription:

Chapter 3.7 Clock-Synchronisation hronisation 3.7. Clock Synch 1 Content Introduction Physical Clocks - How to measure time? - Synchronisation - Cristian s Algorithm - Berkeley Algorithm - NTP / SNTP - PTP IEEE 1588 Logical Clocks Ordering Event counting Lampert s algorithm Vector Clocks 2 1

Introduction (1) Clock synchronization for what? Temporal ordering of events produced by concurrent processes Synchronization between senders and receivers of messages Coordination of joint activity Serialization of concurrent access for shared objects Time stamps for authentication, avoiding duplication of transactions 3 Introduction (2) Logical clock keeps track of event ordering among related (causal) events Physical clocks are useful to have the system keep good real time Set to time of day Consistent across systems 4 2

Introduction (3) When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time. 5 Content Introduction Physical Clocks - How to measure time - Synchronisation - Cristian s Algorithm - Berkeley Algorithmen - NTP / SNTP - PTP IEEE 1588 Logical Clocks Ordering Event counting Lampert s algorithm Vector Clocks 6 3

How to measure time? Use a periodic process or a time dependent process hronisation 3.7. Clock Synch 7 Physical Clocks (1) Mean Solar Second Computation of the mean solar day. hronisation 3.7. Clock Synch 8 4

Physical Clocks (2) TAI: International Atomic Time Atomic Clock (1948), more than 50 different Clocks, Mean-Value Number of ticks of the cesium 133 clock since midnight on Jan. 1. 1958 divided by 9.192.631.700,0 9 Braunschweig Paris Physical Clocks (3) UTC: Universal Coordinated time TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with the sun. Offered by: shortwave-radio, satellites, 10 5

Computer-Clocks (1) CMOS clock (counter) circuit driven by a quartz oscillator battery backup to continue measuring time when power is off OS generally programs a timer circuit to generate an interrupt periodically e.g., 60 or 100 interrupts per second Programmable Interrupt Controller (PIC) Interrupt tservice procedure adds 1 to a counter in memory 11 Computer Clocks (2) Oszillator (i) TC Counter(i) Clock C( t) = α H( t) +β i Hi(t) : local hardware-clock i Ci(t) : local system time 12 6

Synchronization / Problems System 1 System 2 Getting two systems to agree on time Two clocks hardly ever agree Quartz oscillators oscillate at slightly different frequencies Clocks tick at different rates Create ever-widening gap in perceived time Clock Drift Difference between two clocks at one point in time Clock Skew 13 Ideal Clock too fast C(t) too slow t: UTC 14 7

Dealing with Drift (1) synchronization point too fast C(t) t: UTC Time goes back! 15 Dealing with Drift (2) synchronization point too fast Modify rate! C(t) t: UTC 16 8

Clock Synchronization Algorithms The relation between clock time and UTC when clocks tick at different rates. dc 1 ρ 1+ ρ dt ρ maximum drift rate Error δ (Δt after Sync) δ = 2ρΔt resync time : Δt = δ 2ρ 17 Requirements to clocks Requirements to Hardware-Clock (1 ρ)( t a t b ) H ( t a ) H ( t b ) (1 + ρ)( t a t b ) Requirements to local system time: monoton a b a ( t > t ) C( t ) > C( t b ) 18 9

Getting accurate time Different technical clocks will give different times: -> Synchronize to a better clock! 19 External Synchronisation: Time will be compared with UTC (Coordinated Universal Time ) given by a UTC-Timesource S(t) { 1,2 N} S( t) Ci ( t) D i,... D: Synchronizationerror Time Server: machine that provides time information Synchronization Algorithms: Ensure that condition is always fulfilled. Simplest solution: RPC - Issue RPC to obtain time -Set time Client what is the time? 3:59:48:12 Time Server Does not account for network or processing latency 20 10

Cristian's Algorithm Getting the current time from a time server. Compensate for delays, Note times: request sent: T0 reply received: T1 Assume network delays are symmetric T 1 T T T 0 Client = Server + 2 21 Error Bounds hronisation 3.7. Clock Synch 22 11

Cristian s algorithm: example hronisation 3.7. Clock Synch 23 Internal Synchronisation Different technical clocks will give different times: Ensure that clocks inside a network show the same time Internal Synchronisation: Time will be compared with the time of other computers in the network. Real physical time ist not neceassary to know. D: Synchronisationerror { 1,2 N} C j ( t) Ci ( t) D i, j,... 24 12

Berkeley algorithm Gusella & Zatti, 1989 Assumes no machine has an accurate time source Obtains average from participating computers Synchronizes all clocks to average 25 Berkeley algorithm Each machine has a time daemon. One machine master, all other slaves The time daemon master asks all the other machines for their clock values, The machines answer The time daemon master calculates mean value and tells everyone how to adjust their clock 26 13

Berkeley Algorithm: example hronisation 3.7. Clock Synch 27 NTP: Network Time Protocol 1991, 1992 Internet Standard, version 3: RFC 1305 Enable clients across Internet to be accurately synchronized to UTC despite message delays Use statistical techniques to filter data and gauge quality of results Provide reliable service Survive lengthy losses of connectivity Redundant paths Redundant servers Enable clients to synchronize frequently offset effects of clock drift Provide protection against interference Authenticate source of data 28 14

NTP: Network Time Protocol Distribution of universal time "Despite the large and variable message delays encountered" NTP uses UDP port 123 as its transport layer. It is designed particularly to resist the effects of variable latency. in use since 1985, NTP was originally designed by Dave Mills of the University of Delaware, who still maintains it, along with a team of volunteers. The NTP daemon is a user-level process that runs continuously on a machine that supports NTP, and most of the protocol is implemented in this use. 29 NTP Servers Arranged in strata 1st stratum: machines connected directly to accurate time source 2nd stratum: machines synchronized from 1 st stratum machines SYNCHRONIZATION SUBNET 30 15

NTP Synchronization Modes Multicast mode for high speed LANS Lower accuracy but efficient Procedure call mode Similar to Cristian s algorithm Symmetric mode Intended d for master servers Pair of servers exchange messages and retain data to improve synchronization over Time All messages delivered unreliably with UDP 31 NTP Messages Procedure call and symmetric mode Messages exchanged in pairs NTP calculates: l Offset for each pair of messages Estimate of offset between two clocks Delay Transmit time between two messages Filter Dispersion Estimate of error quality of results Based on accuracy of server s clock and consistency of network transit time Use this data to find preferred server: lower stratum & lowest total dispersion 32 16

NTP Message Structure Leap second indicator Last minute has 59, 60, 61 seconds Version number Mode (symmetric, unicast, broadcast) Stratum (1=primary reference, 2-15) Poll interval Maximum interval between 2 successive messages, nearest power of 2 Precision of local clock Nearest power of 2 33 NTP message structure Root delay Total roundtrip delay to primary source (16 bits seconds, 16 bits decimal) Root dispersion Nominal error relative to primary source Reference clock ID Atomic, NIST dial-up, radio, LORAN-C navigation system, GOES, GPS, Reference timestamp Time at which clock was last set (64 bit) Authenticator (key ID, digest) Signature (ignored in SNTP) 34 17

NTP Message structure T1: originate timestamp Time request departed client (client s time) T2: receive timestamp Time request arrived at server (server s time) T3: transmit timestamp Time request left server (server s time) 35 NTP s validation tests Timestamp provided last timestamp received duplicate message? Originating timestamp in message consistent with sent data Messages arriving in order? Timestamp within range? Originating and received timestamps 0? Authentication disabled? Else authenticate Peer clock is synchronized? Don t sync with clock of higher stratum # Reasonable data for delay & dispersion 36 18

SNTP Simple Network Time Protocol Based on Unicast mode of NTP Subset of NTP, not new protocol Operates in multicast or procedure call mode Recommended for environments where server is root node and client is leaf of synchronization subnet Root delay, root dispersion, reference timestamp ignored RFC 4330 37 SNTP hronisation 3.7. Clock Synch 38 19

SNTP example hronisation 3.7. Clock Synch 39 PTP: Precesion Time Protocol Defined in IEEE 1588 Local networks (Ethernet) Multicast-messages Distributed automation systems with synchronisation better than 1 μs 40 20

PTP: The Problem hronisation 3.7. Clock Synch 41 PTP: Synchronisation hronisation 3.7. Clock Synch 42 21

PTP: Synchronization Example hronisation 3.7. Clock Synch 43 PTP: Time-Stamping hronisation 3.7. Clock Synch 44 22

PTP: Boundary Clock hronisation 3.7. Clock Synch 45 PTP - Sequences hronisation 3.7. Clock Synch 46 23

PTP: Tree-Structures hronisation 3.7. Clock Synch 47 Content Introduction Physical Clocks - How to measure time? - Synchronisation - Cristian s Algorithm - Berkeley Algorithm - NTP / SNTP - PTP IEEE 1588 - Questions Logical Clocks Ordering Event counting Lampert s algorithm Vector Clocks 48 24

Questions (1) What is the difference between TAI und UTC? Name at least three sources of delay, that can be introduced between a broadcast time source (Radio, Satellite, ) and the processors in distributed systems, setting there time-clocks. Consider two machines in a distributed system. Both clocks are supposed to tick 1000 times per millisecond. One of them does, but the other does only 990 times/ms. If a UTC Update arrives once a minute, what is the maximum clock skew that will occur? 49 Questions (2) For a clock in a Processor the accuracy is given as 0.005%. The Hardware-clock gives 10 000 ticks/ms. Is it possible to get a synchronization better than 1 ms? What would be the condition? Christian s algorithm shall be implemented in a distributed CAN System running at 1 Mbit/s. Give an description, how this can be done. Calculate the best case Error-Bound that can be achieved. Why is a timestamping done near the Hardware- Interface in PTP? What is the advantage related to time-stamping at the application layer? 50 25

Content Introduction Physical Clocks - How to measure time? - Synchronisation - Cristian s Algorithm - Berkeley Algorithm - NTP / SNTP - PTP IEEE 1588 Logical Clocks Ordering Event counting Lampert s algorithm Vector Clocks 51 Logical Clocks Assign sequence numbers to events All cooperating processes can agree on order of events vs. physical clocks: time of day Assume no central time source Each system maintains its own local clock No total ordering of events No concept of happened-when h 52 26

Lamport s Happened before Processes agree, in which order events occur Lamport s happened-before notation a b: event a happened before event b e.g.: a: message being sent, b: receipt Transitive: if a b and b c then a c 53 Example (1) Three systems: P1, P2, P3 Events a, b, c, Local event counter on each system Systems occasionally communicates 54 27

Lamport Timestamps Assign time value to each event if a b then clock(a) < clock(b) since time cannot run backwards If a and b occur on different processes that do not exchange messages, then neither a b nor b a are true These events are concurrent 55 Lampert s algorithm Each message carries a timestamp of the sender s clock When a message arrives: if receiver s clock < message timestamp set system clock to (message timestamp + 1) else do nothing clock must be advanced between any two events Algorithm allows us to maintain time ordering among related events Partial ordering 56 28

Lamport s algorithm 0 6 12 18 24 30 36 42 48 54 60 A 6 D 0 8 16 24 32 40 48 56 64 72 80 B 24 C 60 0 10 20 30 40 50 60 70 80 90 100 0 6 12 18 24 30 36 42 48 70 76 64 48 A 6 D 69 0 8 16 24 32 40 48 61 69 77 85 B 24 C 60 0 10 20 30 40 50 60 70 80 90 100 57 P1 P2 P3 P1 P2 P3 Lamport:Problem 1 a b, b c, : local events are sequenced j c, f k, g d, : Lamport imposes a send receive relationship Concurrent events (e.g., k, i) may have the same timestamp or not 58 29

Creating unique timestamps (total ordering) Idea: If two events never happen exactly at the same time We can force each timestamp to be unique Define global logical timestamp (Ti, i) Ti represents local Lamport timestamp i represents process number (globally unique), E.g. (host address, process ID) Compare timestamps: (Ti, i) < (Tj, j) if and only if Ti < Tj or Ti = Tj and i < j 59 Lamport: Problem 2 Detecting causal relations If L(e) < L(e ) Cannot conclude that e e e Looking at Lamport timestamps Cannot conclude which events are causally related Solution: use a vector clock 60 30

Vector clocks 61 Define: Vi[i]: Number of Events so far occured in Process i known by process i Vi[j]: Number of events so far occured in Process j known by process i Rules: 1. Vector initialized to 0 at each process Pi Vi[j]= 0 for i,j=1,, N 2. Process increments its element of the vector in local vector before timestamping event: Vi[i] = Vi[i] +1 (No. of events so far occured) 3. Message is sent from process Pi with Vi attached to it 4. When Pj receives message, compares vectors element by element Sets local vector to higher of two values Vj[i] = max(vi[i], Vj[i]) for i=1,, N Comparing vector timestamps Define V=V if V [i] = V [i] for i=1,, N V V if V [i] V [i] for i=1,, N For any two events e, e if e e then V(e) < V(e ) Just like Lamport s algorithm if V(e) < V(e ) then e e Two events are concurrent if neither V(e) V(e ) nor V(e ) V(e) 62 31

Vector-Timestamp V1 [1,2,3] (1,0,0) (000) (0,0,0) a V2 [1,2,3] (0,0,0) (2,0,0) b (2,1,0) c (2,2,0) d P1 P2 V3 [1,2,3] (0,0,0) (0,0,1) e (2,2,2) f P3 63 Vector-Timestamp (0,0,0) (0,0,0) (1,0,0) a (2,0,0) b (2,1,0) c (2,2,0) d P1 P2 (0,0,0) (0,0,1) e concurrent events (2,2,2) f P3 64 32