Google Interview Question

What is/how to a avoid a deadlock (thorough understanding required)