July 28, 2005

Whilst on the subject of deadlocks

It must be a deadlock kinda day. Pete McKinstry points to a Java deadlock avoidance scheme which involves knowing and using a total ordering of the locks that you wish to acquire. This is similar to Andrei Alexandrescu's C++ idea of always acquiring multiple locks in increasing memory address order.

Both of these are fine if you can get at all of the locks from one place. I find that that's rarely the case and more often the locks are within objects and I don't want to break the encapsulation to expose the need to lock around a method so that I can grab the lock that's inside of the object and then use it from outside of the object in some multiple lock, deadlock avoidance, total ordering, code based lock scheme... In my opinion these ideas are all well and good in theory but just don't tend to work in practice if you are working with properly factored code....


Share this entry: Email it! | bookmark it! | digg it! | reddit!

Posted by Len at July 28, 2005 07:56 PM | Comments (0) | Categories : Geek Speak
Comments
Post a comment









Remember personal info?




Enter this code in the box below to prove that you're not some kind of automated spam robot...