Threaded runtime (was Re: [Haskell-cafe] Project postmortem)

Joel Reymont joelr1 at
Fri Dec 2 08:31:56 EST 2005


On Dec 2, 2005, at 1:16 PM, Simon Marlow wrote:

> No - the runtime is completely single-threaded without -threaded.
> Blocking I/O is managed by the runtime.  With -threaded, blocking I/ 
> O is
> managed by a Haskell thread.  The programmer shouldn't see any
> difference in the behaviour of I/O.

I was going on this quote by Simon PJ:

It should be find to have lots of threads, esp if most of them are
asleep.  The only thing to watch out for is that GHC's runtime system
will consume one *OS* thread for each *blocked* foreign call.  So if you
have 10k threads each making a separate call to the OS to read from 10k
sockets, and they all block, you'll use 10k OS threads, and that will
probably fail.

Is this correct and if so how does it mesh with what you said above?

> Is the documentation for -threaded lacking?  I realise it's a bit  
> terse,
> but do you have any concrete suggestions for improving it?

Not at the moment but I'll think about it once I understand everything.
It could be worth summarizing every clarification in this thread.

	Thanks, Joel


More information about the Haskell-Cafe mailing list