logicalclockspart1 - Lamports Logical Clocks Totally Ordered Multicasting Reference L Lamport Time Clocks and the Ordering of Events in Distributed

logicalclockspart1 - Lamports Logical Clocks Totally...

This preview shows page 1 - 10 out of 29 pages.

Lamport’s Logical Clocks & Totally Ordered Multicasting
Image of page 1
Reference L. Lamport, “Time, Clocks and the Ordering of Events in Distributed Systems,” Communications of the ACM, Vol. 21, No. 7, July 1978, pp. 558-565.
Image of page 2
The Happened-Before Relation Lamport’s algorithm synchronizes logical clocks and is based on the happened-before relation: a b is read as “ a happened before b” The definition of the happened-before relation: If a and b are events in the same process and a occurs before b , then a b For any message m , send(m) send(m) rcv(m), where send(m) is the event of sending the message and rcv(m) is event of receiving it. If a , b and c are events such that a b and b c then a c
Image of page 3
The Happened-Before Relation If two events, x and y , happen in different processes that do not exchange messages , then x y is not true, but neither is y x The happened-before relation is sometimes referred to as causality.
Image of page 4
Lamport’s Algorithm We need a way of measuring time such that for every event a , we can assign it a time value C(a) on which all processes agree on the following: The clock time C must monotonically increase i.e., always go forward. If a b then C(a) < C(b) Each process, p, maintains a local counter C p The counter is adjusted based on the rules presented on the next page.
Image of page 5
Lamport’s Algorithm 1. C p is incremented before each event is issued at process p : C p = C p + 1 2. When p sends a message m , it piggybacks on m the value t=C p 3. On receiving (m,t) , process q computes C q = max(C q ,t) and then applies the first rule before timestamping the event rcv(m) .
Image of page 6
Example a b P1 P2 P3 c d e f g h i j k l Assume that each process’s logical clock is set to 0
Image of page 7
Example a b P1 P2 P3 c d e f g h i j k l Assume that each process’s logical clock is set to 0 1 1 1 2 3 2 3 4 4 5 6 3
Image of page 8
Example From the timing diagram on the previous slide, what can you say about the following events?
Image of page 9
Image of page 10

You've reached the end of your free preview.

Want to read all 29 pages?

  • Fall '16
  • Áa
  • Order theory, UCI race classifications, Tour de Georgia, Total order, Total relation

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes