Re: Send Message while processing
Richard Carlsson <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CANKG3zkndU3Sbx7FgEbni-LNfNNC1raW0dsnP_3p6fD4FzMzCw@mail.gmail.com> |
Here is a very good recent blog post by the OTP team explaining how the
message queue locking works and the new optimizations they have just done
to make it scale even better:
https://www.erlang.org/blog/parallel-signal-sending-optimization/
And as an Erlang programmer, you don't really have to think about any of
this - it just works.
/Richard
Den tis 7 dec. 2021 kl 13:07 skrev Dániel Szoboszlay <[email protected]
>:
> 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.
>>
>>