[Haskell-cafe] Re: Hugsvs GHC (again)was: Re: Somerandomnewbiequestions

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jan 19 11:36:44 EST 2005


On Wed, 2005-01-19 at 15:06 +0000, Keean Schupke wrote:
> Why not use a thread-pool, and a "safe" call to read, provided there is 
> an OS thread available,
> defaulting to "unsafe" if no thread is available... You could make the 
> thread pool size an argument...

If it's just a question of speed then the fastest IO system is the
variety that GHC uses now: a single OS thread that multiplexes all IO
requests using a select loop.

The fastest network servers work this way too. Hundreds of network
clients with a single OS thread using multiplexed non-blocking IO and
using epoll (or an equivalent). I don't think there are many that use
many threads to do async IO. Probably the only servers that use the
thread pool IO style seriously are things like Oracle.

If you have more than one CPU you would want more than one OS thread.
The number of threads should scale with the number of CPUs not the
number of Haskell threads that want to do IO.

Duncan



More information about the Haskell-Cafe mailing list