Concurrency

Epoll

Linux IO multiplexing — register fds, get notifications on readiness.


In plain terms

Replaces select/poll which were O(N) per call. epoll_wait is O(1). The foundation of every async Linux network server.

Origin

Added to Linux 2.5.45 (2002) by Davide Libenzi. Solved the C10K problem by giving O(1) ready-fd notification instead of O(N) per call. Kqueue (FreeBSD, 2000) was the inspiration.

Where it shows up in production
  • Node.js libuv epoll on Linux, kqueue on macOS, IOCP on Windows. All same shape.
  • Go netpoller Goroutines blocked on network I/O park on epoll readiness; the scheduler reschedules them when ready.
  • Nginx, Redis Single-threaded event loops on epoll. The reason both scale to 100k+ connections per process.
Sources & further reading
Found this useful?