Unmasking netpoll.go
summary
Explains the concrete claim that Go uses nonblocking sockets registered with netpoll.go and the kernel epoll instance so every accepted connection is added to the poll set and never blocks an OS thread. Shows the actual runtime data flow: the m:n scheduler parks goroutines on EAGAIN, calls schedule, pollWait yields ready fds and a linked list of runnable goroutines, scheduler pushes all but the first to the global run queue and resumes execution, enabling tens of thousands of concurrent connections.
AI-written summary · about
chapters (9)
- 0:00Start
- 2:47How Go Handles Network File Descriptors
- 4:08Non-Blocking Socket
- 4:44Poll Descriptor
- 8:16Run Time Context
- 10:55Global Run Queue
- 11:47When Does the Runtime Scheduler Get Invoked
- 14:53Polling a Network
- 15:43Recap
related talks
47mQueues, Fairness, and The Go Scheduler
22mTales of Go Runtime Scheduler
14mDr Gopher, Anatomy of the Scheduler
47mUnbounded Concurrency in Go
29mGoing Infinite: Handling 1 Million Websocket Connections in Go
31mFrom Polling to Pushing: Going Realtime with Go, gRPC, and Redis
24mMastering Concurrency in Go: From Patterns to Production
23mBuilding a net Conn Type From the Ground Up
