Subj : Re: Deadlock theorem To : comp.programming.threads From : junker98 Date : Tue May 03 2005 02:13 am "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:... > Theorem: > a) "There will be no deadlock if the objects are locked in the same order." > b) "Unlocking can be done in any order." > > Some explanation: > "Order" in this context means sequence. > The theorem applies equally well to both sequential and parallel processing > (ie. threads, tasks, processes, coroutines etc.), and regardless of the number > of objects one wishes to lock in any of the parallel running units (aka threads). > That is: the objects designated for locking, and the number of them, can be > different in each thread; only the locking sequence (order) must be the same in all threads. > > (If this theorem is new then I would like to give it the name "Mutlu theorem" :-) I've worked on multithreaded projects that use this technique before. We always described it as ordered locking, although that probably isn't the only name for the technique. When I was new to writing multithreading code and did some research on the Internet, I found many descriptions of ordered locking systems to avoid deadlock. What you have described does not sound any different to me, unless there is something I am missing? Try googling for "ordered locking" and deadlock and you should find plenty of information on this technique. .