FFI: number of worker threads?

Seth Kurtzberg seth at cql.com
Tue Jun 20 23:18:48 EDT 2006


I have a related question.  The docs state that in some environments O/S threads are used when the -threaded flag is used with ghc, and non-O/S threads are used otherwise (presumably these are non-preemptive).  Does this apply as well to the worker threads that are the subject of this email?

On Tue, 20 Jun 2006 22:57:17 -0400
"Li, Peng" <ringer9cs+ghc at gmail.com> wrote:

> 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
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 


More information about the Glasgow-haskell-users mailing list