Native Threads in the RTS

Simon Marlow
Mon, 18 Nov 2002 11:38:20 -0000

> We can't currently allow several Haskell threads to really run=20
> simultaneosly [e.g. on two separate processors, or preemtively=20
> scheduled on a single processor], because they always mutate the same=20
> global heap. Currently, GHC switches its green threads only at times=20
> when the heap is in a defined state [not truly preemptively]. There=20
> seems to be some SMP support in the RTS, I don't know if it ever=20
> worked. If anyone wants to fix/finish it, that would be=20
> great, but it's not what I'm proposing here.

The SMP support is an experiment that was never finished.  There are
serious issues to be solved regarding reducing the locking overhead on a
shared-memory heap.

> My proposal is only a minimum solution intended to resolve=20
> the inherent=20
> incompatibility between the "threaded RTS" and libraries like OpenGL,=20
> which require thread-local-state.

I think I'm happy with that, although I don't have the whole context
swapped in.  That seems to be the conclusion we came to at the last
discussion, though: