[erlang-questions] Fwd: Question about registry semantics for the remote processes.
Alexander V Vershilov
alexander.vershilov@REDACTED
Wed Jan 14 11:57:15 CET 2015
Hello.
I want to understand the reasons for the current semantics
for saving remote processes in local registry.
According to the specification for register function [1] it's
impossible to save remote process in local registry:
Failure: badarg if PidOrPort is not an existing,
local process or port, if RegName is already in use,
if the process or port is already registered (already has a name),
or if RegName is the atom undefined.
As a result it's not possible to construct expression Name ! Message,
where Name is evaluated to a atom stored in registry that points
to the remote process.
Another approach is described in unified semantics paper (Section 2.3)
However, for uniformity, in this semantics names can be registered
for remote processes (i.e., register(name,pid) does not fail if pid
is a remote process), and registering a local process at a remote
node is supported too (using the operation register(node,name,pid)).
As a consequence, when a message is sent to a remote node using the syntax
{atom,node}!msg there is no guarantee that the process that should
receive the mes-
sage is located at node; thus it may be necessary to relay the message
to a process on yet another node
So I have two questions:
1. Were there any technical reasons for forbidding remote pids in local
registry as we have in current erlang, or it's a historical reasons?
2. If there are technical reasons for that, then why uniformed specification
introduces such behaviour, or it provides some mechanisms to solve
those problems?
One can argue that the reason is monitoring, and case when we are sending
to the remote process from registry that already dead, but I don't see any
difference with sending to remote Pid that already died, semantics of all
the functions and guarantees are the same.
Thanks
[1] http://www.erlang.org/doc/man/erlang.html#register-2
[2] http://happy-testing.com/hans/papers/EW2010-UnifiedSemantics.pdf
--
Alexander
More information about the erlang-questions
mailing list