RFC: termination detection for STM
Brandon Michael Moore
brandon at heave.ugcs.caltech.edu
Wed Feb 14 05:43:24 EST 2007
On Wed, Feb 14, 2007 at 10:04:32AM +0000, Simon Marlow wrote:
> Perhaps I'm missing something, but doesn't GHC already detect the kind of
> deadlock you're talking about here? When a thread is blocked and cannot be
> woken up, it is sent the BlockedOnDeadMVar exception. It's more precise
> than the extension you propose, because the GC is used to check which
> threads are unreachable and therefore cannot be woken up, so it can detect
> mutual-deadlock between two threads in a system that contains other running
> threads.
Perhaps the idea is specifically to detect from the outside when a group of
threads is deadlocked, maybe like something that can be done with computation
spaces in Oz, definitely like the way tree spaces work in Aardappel
( http://wouter.fov120.com/aardappel/ ).
Based on your description, it sounds like it wouldn't work very well to have
a parent thread waiting on a channel, with one of the child threads set up
to catch BlockedOnDeadMVar and send a message, lest the parent thread be
considered deadlocked and sent BlockedOnDeadMVar itself.
What are the semantics of the exception? It seems like it might be tricky
to provide any guarantees, if a thread can catch the exception and make the
MVar live again.
Brandon
More information about the Glasgow-haskell-users
mailing list