Native Threads in the RTS

Simon Marlow
Thu, 28 Nov 2002 16:40:01 -0000

Simon P.J. writes:
> Can you give an example of when a native thread is associated=20
> with more than one Haskell thread?

I gave an example in my previous message.  It's when a bound Haskell
thread makes a foreign call which re-enters Haskell via a bound foreign

> You don't say (and I'm not sure if you mean)
> 	If a bound native thread blocks, all of its associated Haskell=20
> 	threads are blocked too

"When Bagpuss goes to sleep, all his friends go to sleep too." :-)
(apologies to those who never watched British childrens TV in the 70s).

Actually, for any given native thread, only one of its bound Haskell
threads can be runnable, the others must all be blocked waiting on the
result of a foreign call.  So you don't really have to worry about a
native thread being bound to multiple Haskell threads; this would be
quite tricky to implement in the scheduler anyway.