1. A method, comprising: performing, by a thread in a multithreaded program, a resource operation related to at least one mutually exclusive shared resource; monitoring the relationships created by the resource operation between the thread and the at least one mutually exclusive shared resource and other threads in the multithreaded program; detecting deadlocks based on the relationships between the thread and the at least one mutually exclusive shared resource and the other threads of the multithreaded program.