John Meacham john at
Fri Mar 31 16:15:03 EST 2006

On Fri, Mar 31, 2006 at 04:21:26PM +0100, Simon Marlow wrote:
> Great.  Apart from my misgivings about allowing cooperative scheduling
> at all, here's a few comments on the proposal:

much much preferable to a standard that not everyone can implement. :)

>   - I wouldn't include threadWaitRead, threadWaitWrite,
>     or threadDelay at all.  These can all be implemented using
>     FFI, so don't belong in the concurrency library.  Their
>     presence is largely historical.

They all have special implementations on a 'epoll' based system.
threadDelay turns into the timeout parameter to select, waitread/write
turn into the basic building blocks of your epoll wait-list. We
definitly want these in the interface as primitves.

In particular, foregin concurrent calls will most likely be implemented
in _terms_ of threadWaitRead on cooperative systems.

>   - yield bothers me a little.  If it weren't for cooperative
>     systems, yield would be semantically a no-op, because the
>     no-starvation guarantee means you never need it for
>     correctness.  I think it's ok, just a bit unsettling.

even pthreads provides it.

I think you place a lot of faith in pre-emption. :)
In my experience, it doesn't actually buy you a whole lot over
state-threading in the non SMP case.

everything would be different if we were thinking of different
processes on the same computer, where you wouldn't want one buggy one
interfering with others, but in general you consider a single program
buggy or bug-free as a unit.

In any case, IO multiplexing is 90% of the uses of threading anyway,
(ginsu,yi,gui apps that don't do background processing, etc...) which
cooperative threading is ideal for.

not that there arn't itches that only preemptive threads can scratch

>   - In the optional OS threads section it says "allows multiple
>     haskell threads to run at once" - actually you can provide
>     all that without allowing multiple haskell threads to run
>     at once, eg. ghc-6.4.1 with -threaded.  I'll modify it.

okay. yeah, I just sort of outlined the options figuring we would fill
in the details later.


John Meacham - ⑆⑆john⑈

More information about the Haskell-prime mailing list