Send Message while processing

Dániel Szoboszlay dszoboszlay@REDACTED
Tue Dec 7 13:07:15 CET 2021


Hi,

No, the mailbox is not a process. It's a data structure that belongs to the
process (just like its heap, for example). If process B sends a message to
A, it will be the scheduler executing B that writes the message into that
data structure. Process A can be busy doing something else on a different
scheduler, it doesn't have to be involved. There are locks protecting the
mailbox from concurrent access of course, so if A is doing something with
its mailbox at the very same moment, then B will have to wait a little. But
the Erlang VM is carefully written to spend very little time within such
critical sections, so you won't notice this wait in practice.

Hope it helps,
Daniel

On Tue, 7 Dec 2021 at 12:46, Γιάννης Γεωργίου <ggeorgiou@REDACTED> wrote:

>
> Hi,
>
> If process A doing a long work and in the same time process B send
> message to A , I believe that it will successfully recieve the message
> in A's mailbox. So mailboxes of processes are processes too? If not how
> it can save the message while is doing some work?
>
> Thanks for your time.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20211207/46b59b0f/attachment.htm>


More information about the erlang-questions mailing list