paulmac1968 wrote:I'm not sure what you mean. Do you have a simple example?
Process P1 locks resource R1, uses it, and unlocks it, then R2; process P2 locks R2, then R1.
They attempt to do this:
Lock R2 (can't, because P2 has it locked)
Lock R1 (can't, because P1 has it locked)
Now consider changes to P2 so that it uses the resources in the same order as P1:
Lock R1 (Can't, because P1 has it locked)
Lock R1 (Now works, because P1 no longer has it locked)
EOJ Lock R2
No dead lock, right?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day