Before you can stop deadlock, you need to know exactly when it can happen. The four Coffman conditions must all hold together, so breaking any one rules deadlock out. Use them to judge any scenario, from two threads locking two mutexes to a resource allocation graph question. A cycle in the graph proves deadlock only when every resource has a single instance.