Download presentation
Presentation is loading. Please wait.
Published byBrent Clark Modified over 9 years ago
1
Synchronization Chapter 5
2
Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time.
3
Physical Clocks (1) Computation of the mean solar day.
4
Physical Clocks (2) TAI (International Atomic Time) seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with the sun.
5
Clock Synchronization Algorithms The relation between clock time and UTC (Universal Coordinated Time) when clocks tick at different rates.
6
Cristian's Algorithm Getting the current time from a time server.
7
Cristian's Algorithm Two problems: –Time must never run backwards, so backwards changes must be introduced gradually update clock more slowly, for example –The delay for the time to get back may be large, and may be unpredictable (have to subtract propagation time) Can measure several times and take average Can omit values that exceed some threshold Can take only the smallest, since this may be most representative of pur propagation time
8
The Berkeley Algorithm a)The time daemon asks all the other machines for their clock values b)The machines answer c)The time daemon tells everyone how to adjust their clock
9
Lamport Timestamps a)Three processes, each with its own clock. The clocks run at different rates. b)Lamport's algorithm corrects the clocks.
10
Lamport Timestamps In 1978, Leslie Lamport noticed that for most applications synchronization is not important, but only that events be ordered in time. Lamport defined some concepts: 1) if a and b are events in the same process, and a occurs before b, then a b "a happened before b" 2) if a is the event of sending a message and b is the event of receipt of that message, then a b
11
Lamport Timestamps 3) if a b and b c then a c Sometimes we draw a space-time diagram time -----> ---------- a ------------- b ------------------------- Process p1 ------------- c ---- d -------------- g -------------- Process p2 ------------------- e --------------------- f -------- Process p3
12
Lamport Timestamps ---------- a ------------- b ------------------------- Process p1 ------------- c ---- d -------------- g -------------- Process p2 ------------------- e --------------------- f -------- Process p3 Suppose there are messages from c to b, d to f, and e to g c b d f e g d g c d ==> c f
13
Lamport Timestamps ---------- a ------------- b ------------------------- Process p1 ------------- c ---- d -------------- g -------------- Process p2 ------------------- e --------------------- f -------- Process p3 two events a and b are said to be concurrent if it is not true that a b and it is not true that b a d and e are concurrent
14
Example: Totally-Ordered Multicasting An application of Lamport timestamps: Updating a replicated database and leaving it in an inconsistent state.
15
Example: Synchronization with Event Counts and Sequencers Paper by D. P. Reed and R. K. Kanodia, ``Synchronization with Eventcounts and Sequencers,'' Communications of the ACM, 22, 2 (February 1979), pp.115-123
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.