This module consists of the following services:
These services are controlled through 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. For any action resulting 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 example, the specified resource can be a pid. When a global lock is set, access to the locked resource is denied for all resources other than the lock requester.
Both the registration and lock services are atomic. All nodes involved in these actions 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
that runs a globally registered process goes down, the name
is globally unregistered. To this end, the global name
server subscribes to
The name server also maintains 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, try
first to increase the value of
Deletes the lock
Can be used as a name resolving function for
The function unregisters both pids and sends the message
Can be used as a name resolving function for
The function randomly selects one of the pids for registration and kills the other one.
Can be used as a name resolving function for
The function randomly selects one of the pids for registration, and
sends the message
Atomically changes the registered name
Function
Globally associates 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,
function
If you plan to change code without restarting your system,
you must use an external fun (
Three predefined resolve functions exist:
This function is completely synchronous, that is, when this function returns, the name is either registered on all nodes or none.
The function returns
Releases up to and including Erlang/OTP R10 did not check if the
process was already registered. The global name table could
therefore 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 list of all globally registered names.
Sends message
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 that 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. A deadlock can occur if some processes try to lock two or more resources. It is up to the application to detect and rectify a deadlock.
Avoid the following values of
Synchronizes the global name server with all nodes known to
this node. These are the nodes that 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