preemptive vs cooperative: attempt at formalization

John Meacham john at repetae.net
Thu Apr 13 05:53:01 EDT 2006


On Thu, Apr 13, 2006 at 09:46:03AM +0100, Simon Marlow wrote:
> You seem to be assuming more about cooperative scheduling than eg. Hugs
> provides.  I can easily write a thread that starves the rest of the
> system without using any _|_s.  eg.
> 
>   let loop = do x <- readIORef r; writeIORef r (x+1); loop in loop

this is a non-productive non-cooperative loop, as in _|_. since IORefs
can't be shared unless protected by an MVar there is no way to observe
the side effect of this routine. MVar routines since they are
potentially blocking (and moreso because we have the MVar fairness
guarentee),  must be yield points.

> I must be missing something.  The progress guarantee we have on the wiki
> makes complete sense, but the fairness guarantee that John proposed
> seems much stronger.

it was not my intent to be any stronger, but rather just be a
reformulation.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list