Native Threads in the RTS

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Sun, 17 Nov 2002 12:23:06 +0100


Wolfgang Thaller wrote:
 > [...] I propose adding something like
 >
 > forkNativeThread :: IO () -> IO ()
 >
 > which forks a new Haskell thread that has its own OS thread to execute
 > in. Note that the fact that only one Haskell thread may execute at a
 > time remains unchanged. [...]

I haven't thought very deeply about your proposal yet, but I don't understand
the remark above: What about e.g. a multi-processor Solaris machine (where
pthreads work as intended, not the rather poor stuff currently shipped with
Linux)? In such an environment there are often multiple processors executing
different threads (or LWPs, or whatever you call it) of the same process
simultaneously. Perhaps I misunderstood something here...  :-}

Nevertheless, you make a good point: Better support for "real" multi-threading
is definitely an area where I'd like to see some improvement for the next
non-patchlevel release of GHC. I'm still unconvinced that the current optional
RTS support for mixed green/native threads is the right way to go. It looks to
me like a workaround for poor OS support for really lightweight threads.

Cheers,
    S.