Add a new primitive forkOn#, for forking a thread on a specific Capability
authorSimon Marlow <simonmar@microsoft.com>
Mon, 27 Mar 2006 12:41:51 +0000 (12:41 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Mon, 27 Mar 2006 12:41:51 +0000 (12:41 +0000)
This gives some control over affinity, while we figure out the best
way to automatically schedule threads to make best use of the
available parallelism.

In addition to the primitive, there is also:

  GHC.Conc.forkOnIO :: Int -> IO () -> IO ThreadId

where 'forkOnIO i m' creates a thread on Capability (i `rem` N), where
N is the number of available Capabilities set by +RTS -N.

Threads forked by forkOnIO do not automatically migrate when there are
free Capabilities, like normal threads do.  Still, if you're using
forkOnIO exclusively, it's a good idea to do +RTS -qm to disable work
pushing anyway (work pushing takes too much time when the run queues
are large, this is something we need to fix).


No differences found