Native Threads in the RTS

Wolfgang Thaller
Mon, 18 Nov 2002 02:29:38 +0100

I wrote:
> > [...] Note that the fact that only one Haskell thread may execute at 
> a
> > time remains unchanged. [...]

Sven Panne wrote:
> 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,  [...]

We can't currently allow several Haskell threads to really run 
simultaneosly [e.g. on two separate processors, or preemtively 
scheduled on a single processor], because they always mutate the same 
global heap. Currently, GHC switches its green threads only at times 
when the heap is in a defined state [not truly preemptively]. There 
seems to be some SMP support in the RTS, I don't know if it ever 
worked. If anyone wants to fix/finish it, that would be great, but it's 
not what I'm proposing here.
My proposal is only a minimum solution intended to resolve the inherent 
incompatibility between the "threaded RTS" and libraries like OpenGL, 
which require thread-local-state.