What is deadlock? How can it be avoided? How can it be resolved once it occurs?
Deadlock happens when two transactions are each waiting on a resource that the other transaction holds. Deadlock can be stooped by requiring transactions to acquire all locks at the similar time; once it happens, the only way to cure it is to abort one of the transactions and back out of partially completed work.