Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vector clock
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Algorithm for partial ordering of events and detecting causality in distributed systems}} {{distinguish|Version vector}} A '''vector clock''' is a [[data structure]] used for determining the [[partial ordering]] of events in a [[distributed system]] and detecting [[causality]] violations. Just as in [[Lamport timestamp]]s, inter-process messages contain the state of the sending process's [[logical clock]]. A vector clock of a system of ''N'' processes is an [[array data structure|array]]/vector of ''N'' logical clocks, one clock per process; a local "largest possible values" copy of the global clock-array is kept in each process. Denote <math>VC_i</math> as the vector clock maintained by process <math>i</math>, the clock updates proceed as follows:<ref>{{Cite web|title=Distributed Systems 3rd edition (2017)|url=https://www.distributed-systems.net/index.php/books/ds3/|access-date=2021-03-21|website=DISTRIBUTED-SYSTEMS.NET|language=en-US}}</ref> [[Image:Vector Clock.svg|thumb|upright=1.9|Example of a system of vector clocks. Events in the blue region are the causes leading to event B4, whereas those in the red region are the effects of event B4.]] * Initially all clocks are zero. * Each time a process experiences an internal event, it increments its own [[logical clock]] in the vector by one. For instance, upon an event at process <math>i</math>, it updates <math>VC_{i}[i] \leftarrow VC_{i}[i] + 1</math>. * Each time a process sends a message, it increments its own logical clock in the vector by one (as in the bullet above, but not twice for the same event) then it pairs the message with a copy of its own vector and finally sends the pair. * Each time a process receives a message-vector clock pair, it increments its own logical clock in the vector by one and updates each element in its vector by taking the maximum of the value in its own vector clock and the value in the vector in the received pair (for every element). For example, if process <math>P_i</math> receives a message <math>(m, VC_{j})</math> from <math>P_j</math>, it first increments its own logical clock in the vector by one <math>VC_{i}[i]\leftarrow VC_{i}[i]+1</math> and then updates its entire vector by setting <math>VC_{i}[k]\leftarrow \max(VC_{i}[k], VC_{j}[k]), \forall k</math>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)