DIZNR INTERNATIONAL

Vector Clock in Distributed System clock design vector.

Vector Clock in Distributed System clock design vector.

https://www.gyanodhan.com/video/7A2.%20Computer%20Science/Distributed%20Computing/329.%20Vector%20Clock%20in%20Distributed%20Systemclock%20design%20vector.mp4

Vector Clock in Distributed Systems – Clock Design & Concept


What is a Vector Clock?

A Vector Clock is a logical clock mechanism used in distributed systems to capture causal relationships between events β€” especially to determine whether one event happened before another (β†’ β€œhappened-before” relation).

Unlike Lamport clocks (which can only show if events are ordered or concurrent), vector clocks can precisely track causality.


Why is it Needed?

In distributed systems, due to the absence of a global clock:


Vector Clock Design (Structure)

Each process in a distributed system maintains a vector of integers β€” one entry for every process in the system.

Example:

For a system with 3 processes P1, P2, P3, each process maintains a vector clock like:

VC(P1) = [v1, v2, v3]

Where:


How Vector Clocks Work (Rules):

  1. Initialization:
    • Every process starts with vector [0, 0, ..., 0]
  2. Local Event:
    • A process increments its own clock.
    • VC[i] = VC[i] + 1
  3. Send Message:
    • Increment local clock.
    • Send the entire vector along with the message.
  4. Receive Message:
    • Increment own clock.
    • Take the element-wise maximum of the received vector and own vector.
    VC[i] = max(VC[i], received VC[i]) for all i
    

Example:

Let’s assume:

P2 receives message when its clock was [1,2,0]
Now it computes:

VC(P2) = max([1,2,0], [3,0,0]) β†’ [3,2,0]
Then increments its own component β†’ [3,3,0]

Interpretation of Vector Clocks:

For two events with vector clocks VC1 and VC2:


Benefits of Vector Clocks:


Limitations:


Would you like a diagram, visual animation, or real-world application (like in DynamoDB or Git)? I can also provide this in Hindi if you prefer.

Vector Clock in Distributed System clock design vector.

LOGICAL AND VECTOR CLOCKS USED IN …

A Practical Tour of Vector Clock Systems.

Clocks in Distributed System

Chapter 3: Logical Time