Distributed System Lecture 2
Distributed System Lecture 2
Prof. D. S. Yadav
Department of Computer Science 1
IET Lucknow
THE CONCEPT OF TIME
• The Concept of Time
Note :
REFLEXIVE RELATION: A relation R is said to be reflexive over a set A if (a,a) € R for every a € A.
SYMMETRIC RELATION: A relation R is said to be symmetric if (a,b) € R => (b,a) € R
TRANSITIVE RELATION: A relation R is said to be Transitive if (a,b) € R, (b,c) € R => (a,c) € R.
2
TIME AS A PARTIAL ORDER
3
GLOBAL TIME & GLOBAL STATE OF
DISTRIBUTED SYSTEMS
• Asynchronous distributed systems consist of several processes
without common memory which communicate (solely) via
messages with unpredictable transmission delays
• Global time & Global State are hard to realize in distributed
systems
Processes are distributed geographically
Rate of event occurrence can be high (unpredictable)
Event execution times can be small
• We can only approximate the global view
Simulate synchronous distributed system on given asynchronous
systems
Simulate a global time – Logical Clocks
Simulate a global state – Global Snapshots
4
SIMULATE SYNCHRONOUS
DISTRIBUTED SYSTEMS
• Synchronizers [Awerbuch 85]
5
SIMULATING GLOBAL TIME :
CLOCK SKEW & CLOCK DRIFT
• .
6
CLOCK SYNCHRONIZATION
8
PHYSICAL CLOCKS
• How do we measure real time?
17th century - Mechanical clocks based on astronomical
measurements
Solar Day - Transit of the sun
Solar Seconds - Solar Day/(3600*24)
Problem (1940) - Rotation of the earth varies (gets slower)
Mean solar second - average over many days
9
ATOMIC CLOCKS
• 1948
counting transitions of a crystal (Cesium 133) used as
atomic clock
TAI - International Atomic Time
9192631779 transitions = 1 mean solar second in 1948
UTC (Universal Coordinated Time)
From time to time, we skip a solar second to stay in
phase with the sun (30+ times since 1958)
UTC is broadcast by several sources (satellites…)
10
ACCURACY OF COMPUTER CLOCKS
• Modern timer chips have a relative error of 1/100,000 -
0.86 seconds a day
• To maintain synchronized clocks
Can use UTC source (time server) to obtain current notion
of time
Use solutions without UTC.
11
CRISTIAN’S (TIME SERVER) ALGORITHM
12
CRISTIAN’S ALGORITHM
13
BERKELEY UNIX ALGORITHM
• One daemon without UTC
• Periodically, this daemon polls and asks all the machines for
their time
• The machines respond.
• The daemon computes an average time and then broadcasts
this average time.
14
CLOCK SYNCHRONIZATION IN DCE
• DCE’s time model is actually in an interval
15
NETWORK TIME PROTOCOL (NTP)
• Most widely used physical clock synchronization protocol
on the Internet (http://www.ntp.org)
Currently used: NTP V3 and V4
• 10-20 million NTP servers and clients in the Internet
• Claimed Accuracy (Varies)
milliseconds on WANs, submilliseconds on LANs,
submicroseconds using a precision timesource
Nanosecond NTP in progress
16
NTP DESIGN
• Hierarchical tree of time
servers.
The primary server at the
root synchronizes with the
UTC.
The next level contains
secondary servers, which act
as a backup to the primary
server.
At the lowest level is the
synchronization subnet which
has the clients.
17
NTPS OFFSET DELAY ESTIMATION METHOD
18
Time minimum D is chosen to estimate O.
i
Server A T1 T4
From (http://www.ece.udel.edu/~mills/database/brief/seminar/ntp.pdf)
19
From (http://www.ece.udel.edu/~mills/database/brief/seminar/ntp.pdf)
ASSIGNMENT 1
21
22