Algorithm::VectorClocks

Generating a partial ordering of events in a distributed system.
Download

Algorithm::VectorClocks Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Takeru INOUE
  • Publisher web site:
  • http://search.cpan.org/~takeru/

Algorithm::VectorClocks Tags


Algorithm::VectorClocks Description

Generating a partial ordering of events in a distributed system. Algorithm::VectorClocks is a Perl module for generating a partial ordering of events in a distributed system.SYNOPSIS use Algorithm::VectorClocks; ### in server A ### Algorithm::VectorClocks->id('A'); my $vc_a = Algorithm::VectorClocks->new; $vc_a->increment; # same as $vc_a++ my $serialized_a = $vc_a->serialize; # same as "$vc_a" # send a message with $serialized_a to server B ### in server B ### Algorithm::VectorClocks->id('B'); my $vc_b = Algorithm::VectorClocks->new; # receive the message with $serialized_a from server A $vc_b->merge($serialized_a); # same as $vc_b += $serialized_a $vc_b->increment; my $serialized_b = $vc_b->serialize; ### in client ### # retrieves $serialized_a and $serialized_b my @res = order_vector_clocks({ A => $serialized_a, B => $serialized_b }); $res; # 'B' is the latest $res; # 'A'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). Requirements: · Perl


Algorithm::VectorClocks Related Software