Lightningspeed haskell

Hannah Schroeter uk1o@rz.uni-karlsruhe.de
Tue, 20 Mar 2001 13:23:23 +0100


[CC stripped a bit]

On Thu, Mar 01, 2001 at 07:58:26AM +0100, Ketil Malde wrote:
> Jan-Willem Maessen <jmaessen@mit.edu> writes:

> > Absolutely.  Good high-level thread support trumps anything provided
> > by the operating system.

> Unless you have more than one CPU...

No, even then, some high level thread support gains more than
just mapping one thread > one OS process: Acquire (number_of_cpus),
perhaps plus a few spare OS threads/processes and schedule your high
level threads onto them.

I've seen no OS that can handle 4 or 5 figure numbers of threads.
However, Erlang (high level lightweight threads) or Concurrent
Haskell in GHC's implementation *can* handle. In the latter case,
with a memory overhead of about 1 or 2 KB per thread, in contrast
to much more for OS threads (lemme see: a few 100 bytes for the
in-kernel process structure, then one or two pages for the u-structure
incl. per-process kernel-mode stack, in Linux those pages are wired
into memory, in BSD they can be "swapped out" which is OTOH done
only as last resort, and then thread-private stack, at least one
page, sums up to at least 8 KB on i386).

> [...]

Kind regards,

Hannah.