Deadlock Prevention
One of the easiest approaches for avoiding a deadlock would be to obtain all the locks at the begin of the transaction. Though, this approach restricts concurrency very much, also you may lock some of the items that are not updated by that transaction (the transaction may contain if conditions).Therefore, better prevention algorithm have been evolved to stop a deadlock having the basic logic: not to permit circular wait to occur. This approach rolls back some of the transactions instead of letting them wait.