






















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of clock synchronization and mutual exclusion techniques in distributed systems, focusing on lamport timestamps and election algorithms. The slides cover topics such as reference broadcast synchronization (rbs), lamport timestamps, mutual exclusion, and election algorithms in the context of west virginia university's cs 757 distributed systems course.
Typology: Study notes
1 / 62
This page cannot be seen from the preview
Don't miss anything!























































Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Computation of the mean solar day
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
sun - Universal Coordinated Time (UTC)–UTC replaced the old standard – Greenwich Mean Time which is an astronomical
time
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Relation between clock time and UTC when clocks tick at different rates•^
ρ
is the maximum drift rate
UTC in opposite directions at atime
Δ
t after they were synchronized,
they may be 2
ρΔ
t apart
differ more than
δ
, they must be
resynchronized at least every
δ
/(
ρ
) seconds
ρ
ρ
≤
≤
−
1
1
dC dt
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Related problem: Determining one’s position anywhere inthe world
GPS is a satellite-based distributed system launched in 1978^ – 29 satellites, each circulating in an orbit at ~20,
km
each message with its local time
altitude of a receiver on Earth
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
i
with
timestamp
,i
the delay
i^
measured by the receiver is
c,
the measured
distance from the satellite is
for the coordinates of the receiver
and
Δ
r
r
i
now
i^
r
i
r
i
now
i^
c d c T T c c
Δ ⋅ + = Δ ⋅ + − ⋅ = Δ
⋅^
)
(
2
2
2
) ( ) ( ) ( r i r i r i
i^
z z y y x x d − + − + − = )
,
,
(
r
r
r^
z
y
x
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Many things are not perfect^ – GPS does not take leap seconds into account. The deviation from
UTC can easily be taken care in software.
Relatively cheap GPS receivers: precision within 1-5 metersfor the location
Professional receivers, hooked up in a computer network:less than 10-35 nanoseconds error for the time
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
If
’s clock is fast
θ
< 0, which means
should set its clock
backward
However, time is not allowed to run backward
Changes are introduced gradually^ – Assume the timer is set to generate 100 interrupts per second, i.e.,
interrupts are 10
msec
apart
msec
until the correction is made
msec
until the correction is made
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Network Time Protocol (NTP) allows set-up pairwisebetween servers
Eight pairs of (
θ
,δ
) values are buffered. The minimum
δ
is
adopted as the best estimate for the delay and the associated θ
as the best estimate of the offset
NTP divides servers into strata^ – a server with a reference clock is startum-1 server
When
contacts
it will adjust its time only if its stratum
level is higher than the stratum level of
After the
synchronization
s stratum level will become by one
higher than
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
In the last few years, hardware and software forsynchronizing clocks on a wide scale (i.e., over the entireInternet) has become available^ – With this new technology, it is possible to keep millions of clocks
synchronized to within a few milliseconds of UTC
New algorithms that utilize synchronized clocks are startingto appear^ – Enforce at-most-once message delivery to a server, even in the
face of crashes
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
a)
The time daemon polls all the other machines for their clock values b) The machines answer c)
The time daemon tells estimates an average time and tells everyone how toadjust their clocks
Suitable when no machine has a WWV receiver. The time server (i.e., daemon) is active.
Copyright © K.Goseva 2008
CS 757 Distributed Systems
West VirginiaUniversity
Clock Synchronization in Wireless
Networks
m,
each
node
p
records the time when it receives the message
p,m
from its local clock
p
and
q
exchange their corresponding times, so
they can estimate their relative offsetwhere
is the total number of reference messages sent
p
will know the value of
q
’s clock relative to its own
M
T
T
q p
Offset
M k
k q
k p
∑
=
−
=
1
,
,^
)
(
] , [
Copyright © K.Goseva 2008
CS 757 Distributed Systems
Slide 20
West VirginiaUniversity
Clock Synchronization in Wireless
Networks
apart
p
and
q
drift apart, the later values will be
less accurate than the earlier values and simple average asin the previous slide will not work
The constants
α
and
β
are computed from the pairs
β
α
=
t
t
q
p
Offset
)
](
,
[
)
,
(
,
,^
k q
k p^
T
T