[erlang-questions] Questions about PID of remote process

Ulf Wiger ulf.wiger@REDACTED
Thu May 13 09:56:17 CEST 2010


On 05/13/2010 08:16 AM, Bernard Duggan wrote:
> On 13/05/10 15:50, Ulf Wiger wrote:
>>
>>> 2. Can the PID be reused in one node? If a process identified by one PID
>>> died, then this PID can be used to identify other process created later?
>>>      
>> Not if you monitor the process. The monitor is a known reference to the
>> Pid, so it will not be reused. Otherwise, the garbage collector has no
>> knowledge of references to the Pid kept on disk or on other nodes.
>>    
> Ah, right - thanks for clarifying that, Ulf.  Does the monitor continue
> to remain a "known reference" after it sends the {'DOWN'...} message
> about the process?  If so, what, if any, condition /does/ release a
> monitored PID for garbage collection?

I will have to venture an educated guess here, and Bjorn can slap
my fingers if I get it wrong...

If A monitors B, the monitor will automatically go away if:
- A dies
- B dies (and 'DOWN' message is delivered to A)
- A calls demonitor for the given monitor instance
- If A and B are on different nodes, node(A) is disconnected
  from node(B). This doesn't necessarily mean that A died.

Note that A can have several monitor instances towards B.
The above will hold individually for each instance.

BR,
Ulf W
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list