Re: Send Message while processing
Dániel Szoboszlay <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CADcfxongq32uBFdjGdMbwMN9wv9Xpc3gw65-A=+A6RFGny=ddQ@mail.gmail.com> |
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, Γιάννης Γεωργίου <[email protected]> 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. > >