BrLock

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

BrLock is a module featuring a distributed lock, using the algorithm
Carvalho and Roucariol, On mutual exclusion in computer networks,
ACM Communications, Feb83. 

The algorithm features minimal messages for acquiring the next lock, 
but with the trade-off of network being reliable enough to ensure that
all nodes are alive. In fact, one node won't be able to acquire the 
next lock if it can't communicate to all other nodes, unless the node
was the last one to acquire the lock. 

If this is a hard constraint for you, you may want to use IPC::Lock. 


INSTALLATION

To install this module issue these commands:

example/README  view on Meta::CPAN


And, in another one, run 

 perl br-node.pl 3002

And, in yet another one, run 

 perl br-node.pl 3003

In this sample, every node takes 5 seconds to start sending messages. When
a node starts sending messages, every one must be alive, so you must
start all nodes in these 5 seconds. 

Look at the resource.pl monitor. An end() message must always be just after
its corresponding begin(). 

Note: Actually, this isn't always warranted in this example, because the
server is a UDP server which just prints out the message it receives. As 
the receiving order isn't ensured to be the sending order, when a node
releases the resource and another one imeddiately takes it, the next lock
begin() message may reach the resource before the previous one end() 

lib/BrLock.pm  view on Meta::CPAN

 BrLock->br_unlock(); 

=head1 DESCRIPTION

BrLock features a distributed lock, using the algorithm
Carvalho and Roucariol, On mutual exclusion in computer networks,
ACM Communications, Feb83.

The algorithm features minimal messages for acquiring the next lock,
but with the trade-off of network being reliable enough to ensure that
all nodes are alive. In fact, one node won't be able to acquire the
next lock if it can't communicate to all other nodes (unless the node
which was the last one to acquire the lock).

If this is a hard constraint for you, you may want to use IPC::Lock.

The list containing all nodes that may apply for this lock must be
described in the configuration file passed as parameters to the 
environment builder (see SYNOPSIS). The file must be as this:

 0 0



( run in 0.656 second using v1.01-cache-2.11-cpan-39bf76dae61 )