[erlang-questions] Can Erlang messages be delivered out of order?
Sun Jan 25 16:01:32 CET 2009
2009/1/25 Sergey S <>
> > If you read the manual, you'll find that each process have it's own
> > queue, and that new messages are always placed at the end of that queue.
> > So, for you example, yes.
> Thanks. I didn't know how message passing is implemented. It got away
> from me, while I was reading docs on that.
> > However, your example program don't work the way you seem to expect
> > So, even if the messages would have been pleced in the wrong order, your
> program would have worked just as fine.
> Those receive-statements were supposed to illustrate the order in
> which I expect messages will be delivered. But you are right in that
> program will receive all the message independent from the order. So it
> was not very good example to illustrate what I expect =)
Strictly speaking, what erlang guarantees is that if the messages sent from
one process arrive at the destination process then they will arrive in the
order in which they were sent. This is a weaker definition but one which is
reasonable to implement and guarantee in a distributed system. For local
processes you can safely assume all messages arrive at the destination.
This says nothing about how messages from different processes are
interleaved with one another in the destination process, but you can safely
assume that they will be received in the order in which they *arrive*. Or at
least close to that order. It is not safe to assume that this corresponds in
the time order in which they were sent as they may take differently to long
to get there.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions