[erlang-questions] : order-preserving send?

Raimo Niskanen raimo+erlang-questions@REDACTED
Fri Aug 29 09:47:39 CEST 2008


On Thu, Aug 28, 2008 at 03:56:39PM +0200, Hans Svensson wrote:
> Matthias Lang wrote:
: :
> > 
> > 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:

I'd say it is true enough. Since for this to happen, the receiving node
has to be restarted 2 (or was it 3) times to wrap the node incarnation
counter, and Erlang was designed under the assumption that the distributed
application must detect the first node restart anyway and handle it.

Plus, it is a new receiving process that receives B. A went to the old
receiver. The horrible situation where you send A, B, C to a reciever
and B vanishes can not happen. The receiver gets all before a certain
point or all after.

You are supposed to use links or monitors if you are interested
in the other side's death.

> 
> 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
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list