[erlang-questions] Message Ordering and Reliability in Erlang

Matthias Lang <>
Fri Jun 27 07:44:06 CEST 2008


On Fri, Jun 27, 2008 at 11:47:58AM +1200, Fuad Tabba wrote:
> I was wondering, when sending messages in Erlang, is ordering preserved?
> i.e. Process A sends 1 then 2 to B; can I count on B receiving 1 before
> receiving 2 (not talking about selective receive).

>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!)

> What about reliability? Assuming that there aren't faulty processes or
> broken links (slow is ok), is it possible for some messages to be dropped by
> others not? To use the same example, A send 1 then 2, is it possible for B
> to only receive 2?

Covered in the next question in the FAQ. Start reading here:

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

Matt



More information about the erlang-questions mailing list