Professional Documents
Culture Documents
Chapter 21 - Clock Synchronization in Distributed Systems Using NTP and PTP
Chapter 21 - Clock Synchronization in Distributed Systems Using NTP and PTP
Chapter 21
Conclusion
Introduction
Even when initially set accurately, real clocks will differ after
some amount of time due to clock drift, caused by clocks
counting time at slightly different rates.
Cristians Algorithm
Berkeleys Algorithm
Network Time Protocol
Clock Sampling Mutual Network Synchronization
Precision Time Protocol
Reference Broadcast Synchronization
Reference Broadcast Infrastructure
Synchronization
Global Positioning System
Outline
Introduction
Conclusion
Clock Synchronization in a Nutshell
Clocks :
A clock can be considered an instrument to measure, keep,
and indicate time.
Practically, all clocks are built as a two-part device: An
oscillating device, a counter device.
Quartz-crystal oscillators are today the most widely used
oscillators, thanks to their low price, ruggedness, and low
power consumption.
The second part of a clock is a counter or accumulator, which
sums up the oscillations. These oscillators are then divided by
a certain number to generate seconds, minutes, hours, and so
on.
Clocks (Contd..)
A simple approach to describe the time tj at clock j by only two
parameters aj and bj is
t j (t ) = ajt +bj
Synchronization aims for minimizing the clock offset error
e= t j (t)- t
aj being the rate of the clock j
bj the offset, both with respect to the reference clock t.
This information can be shared by various means: It can be
transmitted encapsulated as data in the form of a timestamp
over a packet network, or implicitly in the form of a pulse
signal, which allows the slave clock to synchronize to the
reference clock.
Basic Synchronization Principle
Independent of how the time information is shared, the
packet-based synchronization of state-of-the-art protocols is
either based on a one-way or two-way message exchange.
The one-way message exchange mechanism transmits timing
information from the time source to the sink.
Two-way synchronization extends the one-way exchange by sending
packets from the sink back to the source.
To demonstrate the basic synchronization principle, consider a
synchronization scenario with two clocks i and j.
Without loss of generality, we assume that clock i is identical
to the reference clock, and therefore ti = t and clock j
synchronizes to clock i
Basic Synchronization Principle (Contd..)
Basic Synchronization Principle (Contd..)
Degrees of synchronization
Ordering of events
Relative synchronization
Internal synchronization; reference is internal
Absolute synchronization
Absolute time reference as external reference
Taxonomy of Clock Synchronization Approaches
(Contd..)
Which devices are synchronized?
Sender/Receiver (SR) Synchronization
Receiver/Receiver (RR) Synchronization
Software-based Timestamping
Hardware-based Timestamping
Synchronization Approaches for Packet-Based
Networks
Clock synchronization based on the exchange of time
information encapsulated in data packets is one of the widely
used synchronization techniques due to its seamless
integration into existing network and communication
techniques.
Messages containing timestamps can be transmitted from the
reference clock to the clock to be synchronized, the so-called
slave clock, by various means, ex: wireless
State-of-the-art synchronization technologies just explained
briefly are DCF77, GPS and Inter Range Instrumentation
Group.
In Detail NTP,PTP
DCF77
DCF77 sends the time information using long waves with a standard radio
station. The primary DCF77 transmitter is located in Mainflingen, Germany,
and started radio transmission on January 1, 1959.
The carrier signal at 77.5 kHz is generated from local atomic clocks that are
linked with German master clocks. The time provided by the radio
transmission is Universal Time Coordinated plus 1 h (UTC + 1), Central
Europe Time.
Similar radio time signal stations with slightly different modulations and
encodings are deployed all over the world, such as the WWVB in Fort
Collins, the United States, or the TDF in Allouis, France.
Global Positioning System (GPS)
Conclusion
Network Time Protocol (NTP)
If T(t0) is the UTC time offset determined at t = t0, the UTC time
offset at time t can be expressed by
T(t)=T(t0)+R(t0)(t- t0)+(0.5)D(t0) (t- t0)2+e
The 64 bit time format is commonly used for packet headers and in
systems with limited memory space. It is composed of 32 bit unsigned
seconds (range of 136 years) and 32 bit fraction (resolution of 232 ps).
The 32 bit short format is used only if the range/resolution of the other
formats is not required (e.g., for delay and dispersion header fields). It is
composed of a 16 bit unsigned seconds field and a 16 bit fraction field.
NTP Implementation Model
It is based on four timestamps (t1, t2, t3, t4) and three state
variables origin timestamp org, receiving timestamp rec,
and transmitting timestamp xmt.
On-Wire Protocol (Contd..)
On-Wire Protocol (Contd..)
For each peer, the four most recent timestamps (T1, T2, T3, T4)
are used to compute the offset and the round-trip delay of B
relative to A as described in the standard.
The of the first tuple of the ordered list is used as 0 for the
calculation of the filtered jitter (which is the RMS average of all the
valid tuples)
Conclusion
IEEE 1588 Precision Time Protocol
The IEEE 1588 standard specifies the PTP enabling highly accurate clock
synchronization in packet-based networks.
The class of ordinary clocks consists of master clocks, which provide the
time reference to other nodes, and slave clocks, which synchronize to a
master clock.
It consists of the local clock, the PTP control engine, the data and port data
sets, timestamping functions for event messages, and application-specific
functions.
Precision Time Protocol (Contd..)
Precision Time Protocol (Contd..)
A dedicated master clock synchronizes a group of slaves. This master clock
can be either a boundary clock, a clock synchronizing itself to another PTP
clock, or a PTP grandmaster, which is ideally the best synchronized node in
a whole system, such as a node connected to a GPS receiver or an atomic
clock.
The protocol has two phases, the start phase and the synchronization
phase.
In the start phase, the best master clock (BMC) algorithm is elected by the
so-called BMC algorithm, which finds the device with the best accuracy.
After the BMC algorithm has decided which node to promote as master
clock, the synchronization phase is started where the slave clocks
synchronize to the master clock by an exchange of synchronization
messages.
Master Election: Best Master Clock Algorithm (BMC)
When using the PTP numbering for egress timestamps, t1 and t3, let the transmission at
master or slave be issued in software at time t1 or t 3.
After a certain latency (p1, p3), the first bit of the message is put on the line. After the
propagation delay (tms, tsm), the first bit of the message arrives at the receiver.
Finally, when the entire frame is received, the frame is passed through the network
stack, and the payload is presented to the synchronization application (receive
complete).
p1 and p3 are dependent on the implementation of the network stack in the master or
slave.
Outline
Introduction
Conclusion
Implementation and Application Issues
Synchronous Ethernet (SyncE) was created to fill this gap with the
ITU-T recommendation G.8262.
The idea behind SyncE is to provide high frequency stability through
syntonization with a clock distribution concept that resembles a
cascade of PLLs.
The master node, which is connected to an external reference clock
signal, embeds the clock into the Ethernet transmit signal.
Switches recover the clock, clean it using PLLs, and use it to embed
the clock in the transmit signal until it reaches the final destination.
The SyncE concept was well accepted by telecom carriers as the
core network required no major changes for the introduction of
SyncE.
Synchronous Ethernet and PTP (Contd..)
A particular issue in both 100Base-TX and 1000Base-T is the
asymmetry of the PHY devices and the cabling. The propagation
delays of the wire pairs of a category 5E Unshielded Twisted Pair
(UTP) cable are permitted to differ by up to 50 ns according to the
ANSI/TIA/EIA 568-B specification.
Questions??