POV-Ray : Newsgroups : povray.off-topic : Locking references : Re: Locking references Server Time
5 Sep 2024 05:24:25 EDT (-0400)
  Re: Locking references  
From: Orchid XP v8
Date: 9 Nov 2009 16:44:59
Message: <4af88d5b$1@news.povray.org>
Warp wrote:

>   I still don't understand how the "ascending order" has anything to do
> with locks.
> 
>   Assume process 1 reserves resource 1, and then wants to also reserve
> resource 2. However, resource 2 has already been reserved by process 2,
> which means that process 1 has to wait for it to be freed. Meanwhile
> process 2 tries to also reserve resource 1, but it's already reserved
> by process 1, so process 2 has to wait. They are in a deadlock, waiting
> for each other.
> 
>   What does any "ascending order" of locks have anything to do with this?

Because, if every process always reversed resources in ascending order, 
then both processes above will attempt to reverse resource 1 and then 
resource 2, in that order. In the above example, deadlock occurs exactly 
because the first process tries to get resource 1 and then resource 2, 
but the other process tries to get resource 2 and then resource 1 
(descending order).

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.