Native Threads in the RTS

Simon Peyton-Jones
Mon, 18 Nov 2002 09:01:34 -0000

| I propose adding something like
| forkNativeThread :: IO () -> IO ()

I haven't talked to Simon about this, but it sounds possible.  Three

First, before doing anything like this I'd like to ask you or someone
else, or a group, to write a clear exposition of what the problem is and
what the solution is, to add to the GHC user manual.  (If there are
implementation related questions, they can go into the Commentary.)  As
you say, this is a topic that we have visited regularly, and it's a
slippery one, so I'd like to capture it.

Second, there's the question of what it really means.  In particular,
what if that thread forks further (Haskell, green) threads?  Are they
too bound to the native thread?  A library you call might in principle
fork threads to get its job done...


| If a callback is entered and the current OS thread corresponds to a
| native haskell thread, the callback should be executed in the current
| OS thread.
| Other haskell threads continue to run in the worker thread or in their
| own dedicated OS thread.

I'm not sure what this means.  What is the "current" OS thread?  Perhaps
an example?=20