[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Priority receives in Erlang



"P.H.Welch" <P.H.Welch@xxxxxxxxxx> writes:

> There could be hundreds of 'priority_msg's in the mailbox (sent by
> panicking processes wondering why our process wasn't responding)
> before that second receive gets going and they will all be ignored in
> favour of the 'normal_msg', because they will all be behind it in the
> mailbox queue.

Hmmm. But Erlang's guarantees about message delivery are (deliberately)
pretty weak -- could the panicking processes actually tell that it was
our process's fault, and not the network or runtime system just being
slow to *deliver* the priority_msgs?

Is it possible to construct an example Erlang program where nested
receives and prioritised-receive would result in different behaviours?

> Erlang has not undergone such a revision.

The original designers actually considered having channels and
explicitly rejected the idea, because they found it was too hard to
implement some of the features they thought they needed (e.g. splicing)
with their original runtime system.  Joe Armstrong's paper "A history of
Erlang" in HOPL-III is well worth reading:

  http://dl.acm.org/citation.cfm?id=1238850

-- 
Adam Sampson <ats@xxxxxxxxx>                         <http://offog.org/>