Distributed Computing. Synchronization. Dr. Yingwu Zhu. Topics to Discuss. Physical vs. Logical Clocks Lamport Clocks Lamport Vector Clocks Mutual Exclusion Algorithms Election Algorithms. Synchronization? What’s for?. Temporal ordering of events produced by concurrent processes
Dr. Yingwu Zhu
Frequencies of perfect, slow and fast clocks
±1 msec of UTC (Universal Coordinated Time)
Obtain time broadcasts from Boulder or DC
±3 msec of UTC (depending on distance)
±0.1 msec of UTC
Time server (w/ WWV receiver)
Assumption: latency AB and BA is same, and good estimate!
Offset of A to B: theta = T3 - [(T2-T1) + (T4-T3)] / 2
Delay estimate: delta = [(T2-T1) + (T4-T3)] / 2, keeps the minimum one!
Adjust gradually: e.g., to slow down, add a smaller time for each interrupt
The time daemon tells everyone how to adjust their clock.
(a) Three processes, each with its own clock. The clocks run at different rates.
Lamport clocks: Counters or Sequence numbers
(b) Lamport’s algorithm corrects the clocks (by adding 1).
Updating a replicated database and leaving it in an inconsistent state.
If VC[a] < VC[b] then event a event b
(a) Process 1 asks the coordinator for permission to access a shared resource. Permission is granted.
(b)Process 2 then asks permission to access the same resource. The coordinator does not reply.
(c) When process 1 releases the resource, it tells the coordinator, which then replies to 2.
(a) Process 4 holds an election.
(b) Processes 5 and 6 respond, telling 4 to stop.
(c) Now 5 and 6 each hold an election.
After discovering crash of the old coordinator, some process initiate the ELECTION message circulating the ring (containing process numbers whose processes saw the message)
Then, the COORDINATOR message is circulating again, containing all the members, the process with the highest number is the new coordinator