SlideServe
Menu
Préférences
© SlideServe · v2026

Logical Clocks: Understanding Time Synchronization Algorithms

hoyt-mccray avatar
11 diapositives · 219 Views · Nov 19, 2014

Explore the nuances of clock synchronization using Logical Clocks. Learn about Lamport's Logical Clock, Vector Clocks, and their applications in distributed systems. Understand causality capture and clock maintenance.

Logical Clocks: Understanding Time Synchronization Algorithms - slide 1
01 / 11Logical Clocks: Understanding Time Synchronization Algorithms
1 / 17

Télécharger la présentation

Logical Clocks: Understanding Time Synchronization Algorithms
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Synchronization CSCI 4780/6780

  2. The Berkeley Algorithm • The time daemon asks all the other machines for their clock values • The machines answer • The time daemon tells everyone how to adjust their clock

  3. Logical Clocks • For many applications it is sufficient if all machines agree upon some time • Synchronization with UTC not needed • Logical clocks • Lamport showed that in many cases clock synchronization is not needed • What actually is needed is agreement with regards to ordering of events • Example – Compilation occurred before file editing

  4. Concepts in Logical Clocks • Happens-before relation • a->b if one of the following is true • a and b are events in same process and a occurs before b • If a is an event of sending a message and b is the event of receiving the same message is another process a->b. • Implies that message cannot be received before it is sent • Happens-before is transitive • If a->b and b->c then a->c • If two events in x and y are in two processes that never exchange messages then x & y are concurrent

  5. Lamport’s Logical Clock • Three processes, each with its own clock. The clocks run at different rates.

  6. Lamport’s Algorithm

  7. Placement of Lamport’s Clocks in Dist. Systems

  8. Example: Totally-Ordered Multicasting • Updating a replicated database and leaving it in an inconsistent state.

  9. Problem with Lamport’s Clock What can we infer about: Trcv (m2) < Tsend (m3) Trcv(m1) < Tsend (m2) Lamport’s clock does not capture causality • If a -> b then C(b) > C(a) • But what can you infer by knowing C(e) > C(d)?

  10. Vector Clock • Captures causality • VC(a) < VC (b) implies a causally precedes b • Each process maintains a vector (VCi for Pi) • Size of vector is equal to number of processes in the system • VCi[i] is the number of events that have occurred so far at Pi (VCi[i] is the logical clock at Pi) • VCi[j] = k implies that Pi knows that k events have occurred at Pj (Pi’s knowledge of the local time at Pj)

  11. Maintaining Vector Clock • Vector timestamp algorithm • Three step process • Before executing an event Pi increments VCi[i] • Any message sent from Pi (say, to Pj) will carry the current vector at Pi (VCi) • When Pj receives a message m • Adjusts its own vector (VCj[k] = max (VCj[k], ts(m)[k]) • Executes step 1