Deadlock detection identifies executions that wait indefinitely for one another or unavailable resources, enabling alerts, process restarts, or retry logic after a deadlock occurs. section 11.2 section 11.2.1
A resource allocation graph represents executions and resources as nodes, with request and ownership edges. A cycle indicates a deadlock, and cycle detection can identify it. section 11.1.1 section 11.5
What Go detects—and misses
When every goroutine is blocked, Go’s runtime reports “fatal error: all goroutines are asleep - deadlock!” and includes stack details showing mutex and waitgroup waits. The runtime does not report the same deadlock when main sleeps while another goroutine waits on the waitgroup; the program prints “Done” and exits. section 11.2.1
