FFI: number of worker threads?

Simon Marlow simonmarhaskell at gmail.com
Wed Jun 21 07:41:52 EDT 2006


Seth Kurtzberg wrote:
> I have a related question.  The docs state that in some environments O/S threads are used when the -threaded flag is used with ghc, and non-O/S threads are used otherwise (presumably these are non-preemptive).  Does this apply as well to the worker threads that are the subject of this email?

It sounds like the docs are a bit unclear.  Which bit of doc in 
particular are you referring to?

forkIO always creates a lightweight thread.  With -threaded, if a thread 
makes a safe foreign call, then that call might execute concurrently 
with other threads, because another OS thread (a worker thread) takes 
over in the runtime.  In the HEAD (which will be 6.6), we now allow 
multiple OS threads in the runtime, so you also get to run multiple 
Haskell threads simultaneously, which is particularly useful if you have 
more than one CPU.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list