A deep dive into Go's network poller (netpoller), explaining how the runtime provides a blocking-looking API while using non-blocking I/O under the hood. Covers the pollDesc data structure, the three-state parking protocol (pdNil/pdWait/goroutine pointer) that prevents lost wakeups, platform-specific kernel interfaces (epoll on

24m read timeFrom internals-for-interns.com
Post cover image
Table of contents
The Problem: Blocking API, Non-Blocking RealityThe Journey of a Blocked ReadThe Kitchen Bell: Epoll, Kqueue, IOCPThe pollDesc : The Note at the TableParking: Falling Asleep Without Missing the BellWaking: Ringing the BellDeadlines: Giving Up Without Asking the KernelStale Notifications: Making Sure the Bell Belongs to YouWho Actually Calls netpoll ?Waking the Waiter: netpollBreakPutting It All TogetherSummary

Sort: