This documentation describes the Global module which consists of the following functionalities:
These services are controlled via the process
The ability to globally register names is a central concept in
the programming of distributed Erlang systems. In this module,
the equivalent of the
The registered names are stored in replica global name tables on every node. There is no central storage point. Thus, the translation of a name to a pid is fast, as it is always done locally. When any action in taken which results in a change to the global name table, all tables on other nodes are automatically updated.
Global locks have lock identities and are set on a specific resource. For instance, the specified resource could be a pid. When a global lock is set, access to the locked resource is denied for all other resources other than the lock requester.
Both the registration and lock functionalities are atomic. All nodes involved in these actions will have the same view of the information.
The global name server also performs the critical task of
continuously monitoring changes in node configuration: if a node
which runs a globally registered process goes down, the name
will be globally unregistered. To this end the global name
server subscribes to
The name server will also maintain a fully connected network. For
example, if node
If the global name server fails to connect nodes (
If the fully connected network is not set up properly, the
first thing to try is to increase the value of
Deletes the lock
This function can be used as a name resolving function for
This function can be used as a name resolving function for
This function can be used as a name resolving function for
Globally associates the name
When new nodes are added to the network, they are informed
of the globally registered names that already exist.
The network is also informed of any global names in newly
connected nodes. If any name clashes are discovered,
the
There are three pre-defined resolve functions:
This function is completely synchronous. This means that when this function returns, the name is either registered on all nodes or none.
The function returns
Releases up to and including OTP R10 did not check if the
process was already registered. As a consequence the
global name table could become inconsistent. The old
(buggy) behavior can be chosen by giving the Kernel
application variable
If a process with a registered name dies, or the node goes down, the name is unregistered on all nodes.
Returns a lists of all globally registered names.
Atomically changes the registered name
The
Sends the message
Failure: If
Sets a lock on the specified nodes (or on all nodes if none
are specified) on
If no value for
This function is completely synchronous.
If a process which holds a lock dies, or the node goes down, the locks held by the process are deleted.
The global name server keeps track of all processes sharing the same lock, that is, if two processes set the same lock, both processes must delete the lock.
This function does not address the problem of a deadlock. A deadlock can never occur as long as processes only lock one resource at a time. But if some processes try to lock two or more resources, a deadlock may occur. It is up to the application to detect and rectify a deadlock.
Some values of
Synchronizes the global name server with all nodes known to
this node. These are the nodes which are returned from
The only possible error reason
Sets a lock on
Removes the globally registered name
Returns the pid with the globally registered name