View Single Post
 
Old December 12th, 2005, 11:37 AM
nmunky nmunky is offline
Registered User
 
Join Date: Jun 2004
Location: London, n/a, United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Deadlocks usually happen when 2 processes are vying for control of 2 of the same objects, EG:

Process 1 acesses object A, and holds it whilst trying to access object B.
In the meantime process 2 acesses object B and holds it whilst trying to access object A.

This means that both of them are waiting for access to an object that the other is holding and a deadlock occurs.

The best way around this is to make sure that both of the processes access the objects in the same order, so in this case either process 1 and 2 try to access first A then B, or process 1 and 2 try to access B then A.

Other possible options are to avoid user interaction in these processes, keep any transactions short & try to keep as low an isolation level for transactions as possible.