You are on page 1of 22

Physical time and

Clock
synchronization
Lecture 4
Time in Distributed Systems - UTC

UTC (Coordinated Universal Time)

UTC services are offered by radio stations and satellites


– receivers are available commercially
Accuracy varies with weather conditions

UTC signals take time to propagate – UTC can’t be known exactly


For a given receiver we can estimate a time interval during which an
event has happened
Timers in computers

Based on frequency of oscillation of a quartz crystal

Each computer has a timer that interrupts periodically


Clock drift: in practice, the number of interrupts per hour varies slightly
in the fabricated devices, also with temperature, so clocks may drift,
typically 1/106 (1 sec in 11.6 days)

Timers can be set from transmitted UTC


We have already seen that we cannot know accurately the time at which an event
occurs,
but can only specify an interval
We now have to increase that interval to allow for clock drift
as well as other sources of inaccuracy

Note that computer systems tag events with timestamps, usually a local clock
reading.
Preferably, interval timestamps should be used.
Introduction
• Accurate reliable time is necessary for financial and
legal transactions, transportation and distribution
systems and many other applications involving
distributed resources
• For distributed internet applications, accuracy and
reliability of a clock device is required
• A room temperature quartz oscillator may drift as
much as a second per day
What is clock synchronization?
Clock synchronization requires processes to
bring their clocks close together by using
communication between them
Clock Synchronization
Clock Synchronization
Clock Synchronization
Clock Synchronization
Clock Synchronization
Clock Synchronization Algorithms
The relation between clock time and UTC when clocks tick at different rates.
Fault-Tolerant Clock Synchronization

• The problem is still keeping real-time clocks


synchronized in a distributed system when
processes may fail
• In addition, consider the case where hardware
clocks are subject to drift. Thus, adjusted
clocks may drift apart as time elapses and
periodic resynchronization is necessary
Two Different System Models
Synchronous Distributed System
 Each message is received within bounded time
 Drift of each process’ local clock has a known bound
 Each step in a process takes lb < time < ub
Ex: A collection of processors connected by a communication bus, e.g.,
a Cray supercomputer
• Asynchronous Distributed System
 No bounds on process execution
 The drift rate of a clock is arbitrary
 No bounds on message transmission delays
Ex: The Internet is an asynchronous distributed system
 It would be impossible to accurately synchronize the clocks of two
communicating processes in an asynchronous system
Skew between computer clocks
in a distributed system
Clock synchronization using a time server

mr

mt
p Time server,S
External and Internal Clock synchronization
Cristian’s algorithm

mr

mt
p Time server,S
Cristian’s algorithm
The Network Time Protocol
• To provide a service enabling clients across the
Internet to be synchronized accurately to UTC:
Although large and variable message delays
are encountered in Internet communication,
NTP employs statistical techniques for the
filtering of timing data and it discriminates
between the quality of timing data from
different servers.
The Network Time Protocol
The Network Time Protocol
• To provide a reliable service that can survive lengthy losses of connectivity: There
are redundant servers and redundant paths between the servers. The servers can
reconfigure so as to continue to provide the service if one of them becomes
unreachable.

• To enable clients to resynchronize sufficiently frequently to offset the rates of drift


found in most computers: The service is designed to scale to large numbers of clients
and servers.

To provide protection against interference with the time service, whether malicious
or accidental: The time service uses authentication techniques to check that timing
data originate from the claimed trusted sources. It also validates the return
addresses of messages sent to it.
The Network Time Protocol
• The NTP service is provided by a network of servers located across
the Internet. Primary servers are connected directly to a time source
such as a radio clock receiving UTC;
• secondary servers are synchronized, ultimately, with primary
servers. The servers are connected in a logical hierarchy called a
synchronization subnet
• Arrows denote synchronization control, numbers denote strata.

• whose levels are called strata. Primary servers occupy stratum 1:


they are at the root.
• Stratum 2 servers are secondary servers that are synchronized
directly with the primary servers; stratum 3 servers are
synchronized with stratum 2 servers, and so on. The lowest-level
(leaf) servers execute in users’ workstations.

You might also like