The deadlock is a dreaded state. When non-famous programmers get deadlocked they sometimes call on famous programmers such as Raymond Chen. A late-year entry on his The Old New Thing blog considers the trail one must follow forensically to uncover the culprit. The (somewhat long) title says it: Psychic debugging: The first step in diagnosing a deadlock is a simple matter of following the money.
Chen writes: ”The thing about debugging deadlocks is that you usually don’t need to understand what’s going on. The diagnosis is largely mechanical once you get your foot in the door. (Though sometimes it’s hard to get your initial footing.)”
In Chen’s scheme, finding the deadlock is a matter of figuring out when Thread One is waiting for Thread Two, discerning what the latter thread is doing, and seeing if there is a fatal dependency there that is based on what Thread One is doing.
Note: The treaded comments on this post are great – obviously a few people have more on their minds than Sudoku.
Also, check out Raymond Chen’s annual link clearance. Warning: they are not all about technology issues.