Herb Sutter is well known for his articles on concurrency. Here is an article published on Dr. Dobb’s Journal titled, “The Many Faces of Deadlock”.
There exists a potential deadlock anytime two threads (or other concurrent tasks, such as work items running on a thread pool; for simplicity, I’ll say “threads” for the purposes of this article) try to acquire the same two locks in opposite orders, and the threads might run concurrently. The potential deadlock will only manifest when the threads actually do run concurrently, and interleave in an appropriately bad way where each successfully takes its first lock and then waits forever on the other’s.


