[erlang-questions] Sending messages to non-existing process

Dmytro Lytovchenko dmytro.lytovchenko@REDACTED
Fri Jan 25 17:30:16 CET 2019


You already have it on the senders heap created in the line above.
If receiver exists at any point, there will be a copy to receivers heap.
If receiver never existed, then no new copies will be made.

On Fri, 25 Jan 2019 at 16:19, Frank Muller <frank.muller.erl@REDACTED>
wrote:

> Hey Dmytro
>
> So no matter if receiving process exists or not, those 100000000 messages
> have to be copied on the sender’s heap until next garbage collection is
> performed? Did I get it correctly?
>
> /Frank
>
> 1. A lookup of the process is performed in the dictionary of all pids.
>> 2. Having null result, the message is dropped (and remains in sender's
>> heap until the next garbage collection)
>>
>> There should be no side effect other than the cost of locking/unlocking
>> processes dict for that lookup.
>> Sudden process registration should from that moment have all messages
>> copied into the receiving heap, one copy per send, creating 100000000
>> copies on the receiver heap.
>>
>>
>> On Fri, 25 Jan 2019 at 15:50, Frank Muller <frank.muller.erl@REDACTED>
>> wrote:
>>
>>> Hey guys
>>>
>>> Is there any side effect of sending an infinite stream of messages to a
>>> non-existing process registered by name?
>>>
>>> Ex.
>>> 1> Term = ….
>>> 2> register(foo, self()).
>>> 3> 1 / 0.
>>> 4> [ foo ! Term || _ <- lists:eq(1. 10000000000000) ].
>>>
>>> I’m curious about how the VM handles this scenario internally:
>>>
>>> 1. messages are simply discarded? And if this the case, will this hurt
>>> the VM’s performances?
>>> 2. something else???
>>>
>>> Finally, what will happen if during the sending, a process get
>>> registered with name 'foo' ?
>>>
>>> Thanks in advance
>>> /Frank
>>>
>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190125/50a03ff8/attachment.htm>


More information about the erlang-questions mailing list