preservation of message order

Ulf Wiger etxuwig@REDACTED
Wed Jan 29 16:43:25 CET 2003


On Wed, 29 Jan 2003, Richard Carlsson wrote:

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

Of course. Thank you. I have the specification in my
bookshelf (doesn't everyone?), but it didn't occur to me to
look there. (:



>> 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.

Right again. I was thinking about the
global:safe_whereis_name/1 semantics, but I see now that
this is not even a documented function. Still, since the
'global' reference manual doesn't specify what exactly goes
on in global:send/2, I wouldn't presume that it guarantees
ordering (even if the current _implementation_ does.)

/Uffe
-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks




More information about the erlang-questions mailing list