deadlock detection
Andrew Haley
aph@redhat.com
Sat Sep 6 09:41:00 GMT 2003
Boehm, Hans writes:
> I think that if you want to detect deadlocks on the fly, you really
> only have to check as you are about to lock a heavyweight lock.
> And then it suffices to do a depth-first search of only the
> heavyweight locks reachable from the one we're trying to acquire.
Oh, of course! Thanks Hans.
That's obvious, but for some reason I didn't think of it -- you only
have to look at the part of the graph you changed.
> 1) This is typically very cheap, since you only pay on persistent
> 1) contention, and there probably aren't very many heavyweight
> 1) locks.
>
> 2) There are probably weird cases for which it's expensive. It
> 2) probably shouldn't be the default.
>
> It seems to me that the result is still quite limited though, since
> it only detects deadlocks involving exclusively locks, as opposed
> to wait/notify or more obscure dependencies (IO, wait loops on
> volatiles, etc.) My guess is that this covers around half the half
> the Java deadlocks I've seen, though my experience may be atypical.
That's a useful insight.
Andrew.
More information about the Java
mailing list