One approach to avoid deadlocks is to require each transaction to announce all the locks it wants at the beginning, and to either grant all these locks or deny them all and make the transaction wait.
Does this approach avoid deadlocks due to locking?
Either explain why or give an example of a deadlock that can arise ?