Algorithm-VectorClocks
view release on metacpan or search on metacpan
lib/Algorithm/VectorClocks.pm view on Meta::CPAN
$res[0]; # 'B' is the latest
$res[1]; # 'A'
=head1 DESCRIPTION
Description, shamelessly stolen from Wikipedia:
Vector Clocks is an algorithm for generating a partial ordering of
events in a distributed system. Just as in Lamport timestamps,
interprocess messages contain the state of the sending process's
logical clock. Vector clock of a system of N processes is an array
of N logical clocks, one per process, a local copy of which is kept
in each process with the following rules for clock updates:
* initially all clocks are zero
* each time a process experiences an internal event, it increments
its own logical clock in the vector by one
* each time a process prepares to send a message, it increments its
own logical clock in the vector by one and then sends its entire
vector along with the message being sent
* each time a process receives a message, 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 message (for every
element).
You're encouraged to read the original paper, linked below.
=head1 METHODS
( run in 0.283 second using v1.01-cache-2.11-cpan-8d75d55dd25 )