[Haskell-cafe] Re: concurrent haskell: thread priorities
marlowsd at gmail.com
Fri Jan 9 04:25:54 EST 2009
Bulat Ziganshin wrote:
> Monday, December 22, 2008, 11:07:32 PM, you wrote:
>> The threaded RT creates an OS thread for each CPU/core on the system and
>> uses them to multiplex userland threads. These are context switched
>> whenever they block/yield/gc and no priorities can be assigned.
> not exactly. amount of OS threads created controlled by +RTS -N option
> to the program; unless program has special function that RTS calls to
> set up this value
There might be multiple OS threads per CPU, if for example one of the
Haskell threads makes a safe foreign call another OS thread takes over
running the rest of the Haskell threads on that CPU.
When you say "+RTS -N2" all you are saying is "I want to allow up to 2
Haskell threads to run simultaneously". The actual mapping between Haskell
threads and OS threads is decided by the RTS, hopefully in a sensible way,
within this constraint.
> they are switched on every minor GC which by default occurs after
> each 256kb allocated which is rather frequent event
512Kb by default (caches are bigger these days), and configurable with +RTS
More information about the Haskell-Cafe