Skip to content
  • Simon Marlow's avatar
    Add a new primitive forkOn#, for forking a thread on a specific Capability · c520a3a2
    Simon Marlow authored
    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).
    c520a3a2