[Shootout-list] Haskell ring of messages - fair?
Einar Karttunen
ekarttun@cs.helsinki.fi
Thu, 23 Sep 2004 11:12:10 +0300
On 23.09 09:50, Bengt Kleberg wrote:
> >Is the attached solution fair?
> >It uses mvars (a kind of synchronized variables)
> >to pass the messages and clears the test in
>
> could mvars be used to receive more than one message at the same time?
well they have a buffer size of 1, and by default a synchronous send
routine. That is send blocks if there is a queued item. Of course
that may be exactly what one wants (to avoid killing consumers of
data).
> the idea is that it should be possible for each process to receive more
> than one message at the same time. this is not explicit in the test and
> i think we should change/update the test. i tried several designs for
> the plugin test, and i think each new one was better. this is still the
> first message passing test.
> would it be ok if i changed the test or is the installed base too big? :-)
With just one entry...
Have to use custom channels in haskell though (~20 lines extra) if
queing is needed as the builtin channel implementation manages to be
~60 times slower than mvars (probably some scheduler anomality).
- Einar Karttunen