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

Simon Marlow simonmar at microsoft.com
Wed Mar 29 06:36:24 EST 2006


On 29 March 2006 12:25, Ross Paterson wrote:

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

Good point - I didn't mean to imply that (not cooperative => fair).

Cheers,
	Simon


More information about the Haskell-prime mailing list