From what I read here , the golang scheduler will automatically detect if goroutine is blocked on I / O and will automatically switch to handle other goroutines in a thread that is not blocked.
I am wondering how the scheduler then finds out that this goroutine has stopped the I / O lock.
Does he just do some kind of poll so often to check if everything is blocked? Is there some kind of background thread that checks the status of all goroutines?
For example, if you want to execute an HTTP GET request inside goroutine, which took 5 seconds to get a response, it will block waiting for a response, and the scheduler will switch to processing another goroutine. Now, considering that when the server returns the answer, how does the scheduler understand that the answer has arrived and it is time to return to the goroutine that made the GET so that it can process the GET result?
source share