[Haskell-cafe] Re: Threads not running under GHC 6.10?

Simon Marlow marlowsd at gmail.com
Wed Dec 17 08:05:48 EST 2008


Gwern Branwen wrote:
> On Mon, Dec 15, 2008 at 9:00 AM, Simon Marlow  wrote:
>> This particular example illustrates a bug in 6.10.1 that we've since fixed:
>>
>>  http://hackage.haskell.org/trac/ghc/ticket/2783
> 
> OK, that's good...
> 
>> However in general you can still write expressions that don't allocate
>> anything (e.g. nfib 1000), and your watchdog thread won't get a chance to
>> run unless there's a spare CPU available (+RTS -N2).
>>
>> Cheers,
>>        Simon
> 
> But that's bad. What are my options here? Will this
> threads-not-running issue be fixed in the next release? Since it
> worked fine in 6.8 as far as I could tell, that makes me think that it
> must not be anything completely fundamental and unfixable.

I'm afraid the underlying problem is one that GHC has always had - that we 
can't preempt threads that aren't allocating.  It's not easily fixable, we 
would have to inject dummy heap checks into every non-allocating loop, 
which would seriously hurt performance for those tight loops.

In general you can't rely on being able to kill a thread; however, this 
only applies to compiled code, interpreted code should always be 
preemptable, even if it isn't allocating.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list