Ribamar Santarosa > BrLock > BrLock



Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  


BrLock - Distributed Lock with minimal messages exchanges over a reliable network.


 BrLock->new('cfg_file', # configuration file, (see DESCRIPTION).
            '', # this node's ip.
            3001);       # port to be bound to this node.

 # enter critical region


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 0
 x.x.x.x  port
 y.y.y.y  port

The first line must have two zeros, and the second must have the ip and the 0 port (deprecated parameters, see TODO). The next lines must have a node ip and a node port. All nodes must use the same configuration file, so a node will read its own parameters.

A valid cfg_file for BrLock->new('cfg_file', '', 3001), for an environment with 3 nodes, is: 0 0 0 3002 3001 3003

Note the networking setup will be made by this module. So, after calling Br->new, the node will be listening at in the above example.



Ribamar Santarosa <ribamar@gmail.com>

Tarcisio Genaro <cuervojonas@gmail.com>



syntax highlighting: