basic questions regarding message sequence guarantees...

Robert Virding robert.virding@REDACTED
Tue May 4 00:45:08 CEST 2004


It's quite easy to describe a case where this could happen. N.B. the BEAM
does not *define* the Erlang semantics, it (hopefully) just not break them.

Robert

----- Original Message ----- 
From: "Anders Ramsell" <anders@REDACTED>
To: <erlang-questions@REDACTED>
Sent: Thursday, April 29, 2004 1:48 AM
Subject: Re: basic questions regarding message sequence guarantees...


>
> Kris Prieb wrote:
> > 2.) Now suppose ‘B’ is monitoring ‘A’.  Suppose also that another
> > process ‘C’ is monitoring ‘A’ and that a ‘Down’ message from ‘A’ to ‘C’
> > will trigger ‘C’ to send a message to ‘B.’
> >
> > My understanding is that Erlang does _/not/_ guarantee that A’s ‘Down’
> > message to B will arrive before C’s message to B.  Is this correct?
> >
>
> I have been thinking of asking about a variation of this question
> myself. In my scenario a process A first sends a message 'first' to a
> process B. After that it sends another message 'second' to an
> intermediary process C. When the process C receives the 'second' message
> and only then it will send a message 'second' to process B.
>
> In this scenario we know that two messages are sent from process A. Not
> just one of them. We also know in what order those messages are sent and
> that each message sent from process A will result in exactly one message
> being recieved by process B.
>
> Is it really possible in this scenario for the message 'second' to be
> recieved by the process B before it receives the message 'first'?
>
>   A                  C                 B
>            |                   |                   |
>            |                   |            |----> | (received second)
>            |                   |            |      |
>            |   first           |            |      |
>            | ------------------------------------> | (received first)
>            |   second          |            |      |
>            | ----------------> | (received  |      |
>            |                   |    second) |      |
>            |                   | -----------|      |
>            |                   |                   |
>
>
> It seems funny that a detour can end up being a shortcut.
>
> In some cases it could be useful to know (if that is in fact the case)
> that the order of the messages 'first' and 'second' in the above
> scenario will be preserved.
>
> Of course if in fact such a guarantee can be made it seems to me that it
> would be broken by (almost?) any change to the scenario. I.e. not
> knowing or changing the order of the sends from process A, process C
> sending a 'second' message to process B without receiving one from
> process A, etc. But now I'm rambling...
>
> --
> Anders Ramsell
>
>




More information about the erlang-questions mailing list