
Duncan Coutts wrote:
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.
But what about the continuing computation... we do not want the fastest IO system, but we want the program to comlete the fastest... So ideally we want 2 threads! One runs the Haskell code that is not waiting for IO. (IE other Haskell threads)... The other runs a select loop as you suggest! This way the number of threads is fixed (2) and execution never 'blocks' for IO. (Simon, what about this scheme?)
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.
I completely agree with this, but obviously I would suggest 1 thread per CPU, (maybe 2 including a garbage collector) plus an additional thread on the CPU attached to the IO bus to do IO. Keean.