FFI: number of worker threads?

Li, Peng ringer9cs+ghc at gmail.com
Tue Jun 20 22:57:17 EDT 2006


Hello,

The paper "Extending the Haskell FFI with Concurrency" mentioned the
following in Section 6.3:

"GHC's run-time system employs one OS thread for every bound thread;
additionally, there is a variable number of so-called "worker" OS
threads that are used to execute the unbounded (lightweight) threads."

How does the runtime system determine the number of worker threads?
Is the number hardcoded in the RTS or dynamically adjustable?  Can a
programmer specify it as an RTS option or change it using an API?

I would like to use a large number (say, 2000) of unbounded threads,
each calling a blocking, safe foreign function via FFI import.  What
is supposed to happen if all the worker threads are used up?  I tried
this in the recent GHC 6.5 and got some kind of "runaway worker
threads?" RTS failure message when more than 32 threads are used. Is
it a current limitation of the RTS, or should I file a bug report for
it?

Thanks,
Peng


More information about the Glasgow-haskell-users mailing list