[erlang-questions] Erlang External Term Format for PIDs

Michael Truog <>
Thu Mar 31 22:04:59 CEST 2011


Hi,

I was wondering why the Erlang pid includes both the Node, which is variable length, and the ID integer.  Isn't the ID integer node specific such that every node has a unique index?  I am wondering for unique id generation (not the make ref type, but rather UUID code here https://github.com/okeuday/uuid).  The ID field is explained here http://www.erlang.org/doc/apps/erts/erl_ext_dist.html#REFERENCE_EXT , since it is the same integer used in references.  I am assuming that the external term format wants to be specific to a node as it is currently named, in case it changes names in the future (not sure if that works, but I assume it is possible somehow).  Is that the reason both the Node name and the ID exist together?

The main reason I ask, is just to make sure the ID integer is truly unique for an Erlang node's view of the connected nodes when setting pid data without needing to create a hash from the node name if something needs to be pid-specific without being unique among all connected Erlang nodes (the UUID RFC prefers the MAC address, which may be a worse choice than a hash of the node name, especially since it depends on undocumented function calls).

Thanks,
Michael



More information about the erlang-questions mailing list