Pre-emptive or co-operative concurrency (was: Concurrency)

Ross Paterson ross at soi.city.ac.uk
Wed Mar 29 06:24:35 EST 2006


On Wed, Mar 29, 2006 at 11:44:12AM +0100, Simon Marlow wrote:
> It's much more useful to reserve the term "cooperative" for
> when the burden is on the programmer to insert context-switch points, as
> is the case in Hugs.  This is a significant difference from the
> programmer's point of view, whereas the difference in imlementation
> between GHC and YHC is to a very close approximation invisible.

The dividing line isn't "cooperative", though.  Even if an implementation
did a context switch after each IO action (i.e. in >>=), it would fail
your first fairness requirement, as an IO action looping in pure code
will starve other threads (as does one that doesn't do allocation in GHC).



More information about the Haskell-prime mailing list