poll phase
The event loop phase that asks the operating system for new I/O events, runs their callbacks, and sleeps when there is nothing to do.
In more detail
If no timers are due and no setImmediate callbacks are queued, libuv blocks here, without using CPU, until I/O arrives or the next timer expires. If setImmediate callbacks are waiting it does not sleep and moves straight to the check phase.
Related terms
- event loop phase — One of the six stages the Node.js event loop visits in order on every turn: timers, pending callbacks, idle/prepare, poll, check and close callbacks.
- check phase — The event loop phase straight after the poll phase, which runs callbacks scheduled with setImmediate.
- epoll — The Linux kernel facility that lets one thread watch many file descriptors and be told which are ready for reading or writing.
- min-heap — A heap in which every parent is less than or equal to its children, so the minimum is at the root; a max-heap reverses the order.
Taught in
- Event Loop Lifecycle: The Six Phases & libuv uv_run — Node.js Internals & Backend Services
- Poll & Check Phases: I/O Callbacks & setImmediate — Node.js Internals & Backend Services