[erlang-questions] Do messages casted by Process A always get received before messages called by Process A?

Bob Ippolito bob@REDACTED
Thu Oct 20 00:21:11 CEST 2011


On Wed, Oct 19, 2011 at 3:09 PM, Kris Rasmussen <kris@REDACTED> wrote:
> Geoff, thanks for the response. I think I may have been ambiguous in my
> wording. To be more specific, can you tell me if the following is true:
> Imagine process A does the following:
> call(B, 1)
> cast(B, 2)
> call(B, 3)
> Will B always receive the messages in the order A sent them (1, 2, 3) as
> opposed to something like (1, 3, 2) occasionally?

>From the FAQ [1]:

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

[1] http://www.erlang.org/faq/academic.html#id56948

-bob



More information about the erlang-questions mailing list