[erlang-questions] order-preserving send?

Matthias Lang matthias@REDACTED
Thu Aug 28 01:57:36 CEST 2008


On Wednesday, August 27, atomly wrote:
> [Bill McKeeman <Bill.McKeeman@REDACTED>]
> > 
> >    Simple newbie question.  Suppose I have a process id U, and send two
> >    messages
> > 
> > 
> >    U ! Message1.
> > 
> >    U ! Message2.
> > 
> > 
> >    Is there a guarantee that the messages will be received in the order
> >    they were sent?
> 
> No.  There's not even a guarantee that both (or either) messages will be
> received.

That misleading and, for practical purposes, wrong.

>From the FAQ:

 | 10.9 Is the order of message reception guaranteed?
 | 
 | Yes, but only within one process.
 | 
 | If there is a live process and you send it message A and then message
 | B, it's guaranteed that if message B arrived, message A arrived before
 | it.
 | 
 | On the other hand, imagine processes P, Q and R. P sends message A to
 | Q, and then message B to R. There is no guarantee that A arrives
 | before B. (Distributed Erlang would have a pretty tough time if this
 | was required!)

The next question is also relevant:

http://www.erlang.org/faq/academic.html#10.10

Matt



More information about the erlang-questions mailing list