https://dave.cheney.net/2015/08/08/performance-without-the-event-loop
Excerpts taken from the above article.
Some key points:
In current versions of Go, the network poller has been integrated into the runtime itself. As the runtime knows which goroutine is waiting for the socket to become ready it can put the goroutine back on the same CPU as soon as the packet arrives, reducing latency and increasing throughput.
...
Threads still have an expensive context switch cost; a lot of state must be retained. Goroutines take the idea of threads a step further...
Rather than relying on the kernel to manage their time sharing, goroutines are cooperatively scheduled. The switch between goroutines only happens at well defined points, when an explicit call is made to the Go runtime scheduler.
No comments:
Post a Comment