Subj : Re: Deadlock theorem To : comp.programming.threads From : Uenal Mutlu Date : Wed May 04 2005 07:38 pm "David Schwartz" wrote > > "Uenal Mutlu" wrote > > > That's the big difference: my motivation was to have a method where > > such object dependencies (object hierarchy) aren't required. > > But you wrote: > > > a) There will be no deadlock if the objects are locked in the same order. > > It seems like you're directly contradicting yourself now. No. But I see that what I mean to say is not so easy to understand. Perhaps the following will be a good example: In a relational database there is usually the following hierarchy: table record field What I tried to say is that it does not require the single objects be members of such an hierarchy. They can be, but it's not a must. That would mean that locking a field without locking the record and the table would be possible, whether it makes sense or not. But if there is such a requirement in that table, record, and field must be locked before changing the fields content then one just needs to reflect this relationship in the "list of objects" plus always lock table, record, and field (of course in that order) as a set. But this must be seen as application logic. The locking routines cannot know such relationship within the data. That's what I meant by object independency. By this it is a general purpose flexible method, but if there is such a dependency within the data then it can maybe mean too low-level, because the dependency must be followed by the programmer him-/herself. But still easily doable: one just needs to lock all members of such a set just in the right order. .