Here is the answer,
Deadlock describes a situation where two or more threads are blocked forever, waiting for each other.
Deadlock occurs when multiple threads need the same locks but obtain them in different order. If you make sure that all locks are always taken in the same order by any thread, deadlocks cannot occur.
For more details please go to the link.