As I was learning Go I initially wrote my short programs using an empty for loop to block the program from exiting as I ran my test functions with the go keyword. As my test/learning programs grew in size however, the entire program would sometimes freeze at random places and the debugger would disconnect, making debugging really hard.
I eventually learned that the cause was the empty for loop from a bit of discussion on the IRC, and replaced it with a blocking channel, but I never learned WHY other than it was something to do with how Go handles scheduling.
What mechanism in the background causes independent go-routines to lock entire programs, even when there are plenty of cores allocated to the program, if there is an empty infinite for loop?