preservation of message order

Richard Carlsson richardc@REDACTED
Wed Jan 29 16:30:05 CET 2003


On Tue, 28 Jan 2003, Ulf Wiger wrote:

> Erlang guarantees that the order of messages from one sender
> to another is preserved.
> 
> Does this also mean that a {'DOWN',process,Who,Why} message,
> or an {'EXIT',Pid,Why} message can never reach the recipient
> ahead of the last message sent to same recipient? I hope so.

All signals have this ordering guarantee. Messages are just a subset
of "signals", and so are Exit signals. (There are other, more obscure
signals also, e.g. link requests, which the user never sees directly.)
So if the originating process is the same, the ordering is guaranteed
regardless of the type of signal. (All of this according to the Erlang
reference manual by Barklund/Virding.)

> There are probably restrictions, such as: if the message
> is sent using global:send(...), no such guarantee can be
> made, but if the message is sent using the Pid or
> locally registered name of the process, the guarantee should
> hold.

In fact, even if you use global:send/2, the message is still
dispatched directly by the calling process (after doing a lookup)
so it should not lose the ordering guarantee.

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/




More information about the erlang-questions mailing list