ghci and ghc -threaded broken with pipes & forking

Simon Marlow simonmarhaskell at
Mon Mar 5 11:12:32 EST 2007

Ian Lynagh wrote:
> On Mon, Mar 05, 2007 at 08:36:29AM -0600, John Goerzen wrote:
>> On Mon, Mar 05, 2007 at 12:59:17PM +0000, Simon Marlow wrote:
>>> There seems to be a common misconception that forkOS is necessary to get 
>>> certain kinds of concurrency, and forkIO won't do.  I don't know where this 
>>> comes from: the documentation does seem to be quite clear to me.  The only 
>>> reason to use forkOS is for interacting with foreign code that uses 
>>> thread-local state; everytyhing else can be done with forkIO (and it is 
>>> usually better to use forkIO).
>> >From reading the docs, it sounds like forkIO keeps everything in a
>> single OS thread/process.  Doesn't this mean that a program that uses
>> forkIO instead of forkOS loses out on SMP machines?
> You can use e.g. +RTS -N2 to use 2 OS threads.

I've added a sentence to the forkOS docs to say that you don't need forkOS to 
get parallelism.


More information about the Glasgow-haskell-users mailing list