|
 |
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
|
 |