IntermediateAbout 15 min

    Lamport & Vector Clocks

    Read the full article on Substack

    7 min read.

    Step through messages between three processes as Lamport and vector clocks tick, see which events are concurrent, and watch total order broadcast keep nodes in step.

    Think of it this way: A Lamport clock is a page number in a shared story: when you get a letter marked page 40, your next page is at least 41. A vector clock is a list of how many letters you have read from each friend, so you can tell whether someone wrote without having read your last letter.

    P1P2P3
    P1 clock 0P2 clock 0P3 clock 0

    Three processes, no shared clock. Each keeps one counter and adds 1 at every event.

    1/10

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Before, after or concurrent?

    Sort

    Compare the first vector clock with the second in each pair.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    First happened before

    Drop items here

    First happened after

    Drop items here

    Concurrent

    Drop items here
    6 pieces left to place

    Quiz

    8 questions
    Question 1 of 8
    Score: 0

    A process has Lamport clock 2 and receives a message stamped 6. What is its clock after the receive?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going