|
|
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>> I have heard it suggested that if every thread in a program takes
>> whatever locks it needs to take in sorted order, it is guaranteed that
>> deadlock can never occur.
>
>> Is this correct? And does anybody have a reference I can site?
>
> Perhaps if you explained what it means to "take whatever locks it needs
> to take in sorted order", then I might be able to write some answer.
> I just can't understand what that means.
If you assign a unique ID to every lock in the system, and arrange for
every thread to take whatever locks it needs to take in ascending order,
deadlock is guaranteed not to occur.
Or so I believe, anyway...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|