[erlang-questions] order-preserving send?

Bengt Kleberg <>
Thu Aug 28 16:09:17 CEST 2008


Greetings,

Perhaps it would be better if the FAQ sentence below is changed to:
"If there is a live process and you send it message A and then message
B, it's guaranteed that if both messages arrived, message A arrived
before B."


bengt

> On Thu, 2008-08-28 at 15:56 +0200, Hans Svensson wrote:
> Matthias Lang wrote:
> > On Wednesday, August 27, atomly wrote:
> >> [Bill McKeeman <>]
> >>>    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.
> >  | 
> 
> That is however not true (in the distributed case), it is possible to 
> drop A and then later receive B. The paper 'Programming Distributed 
> Erlang Applications: Pitfalls and Recipes' describes this situation as 
> well as some other quirks:
> 
> http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf
> 
> >  | 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!)
> > 
> 
> That is actually guaranteed in the local (non-distributed) case, then A 
> is actually *always* delivered before B. But as mentioned it doesn't 
> hold in the distributed setting.
> 
> > The next question is also relevant:
> > 
> > http://www.erlang.org/faq/academic.html#10.10
> > 
> 
> 
> /Hans
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list