blocking I/O
An operation that makes the program stop and wait until it finishes, so nothing else on that thread can run meanwhile.
In more detail
In Node.js, blocking the main thread with synchronous file reads, heavy calculations or synchronous compression freezes every request. libuv moves unavoidable blocking work to its thread pool.
Related terms
- asynchronous I/O — Starting an input or output operation and carrying on with other work, being told later, usually through a callback or promise, when it has finished.
- synchronous code — Code that runs start to finish without pausing, so the next line waits for it to complete.
- thread pool — A fixed or bounded set of reusable worker threads that take tasks from a queue, instead of creating a new thread for each task.
- main thread — The first thread a program starts with; in a browser page it also runs JavaScript and handles input, layout and painting.
Taught in
- libuv Architecture: Event Demultiplexer & Thread Pool — Node.js Internals & Backend Services
- Timers Phase: setTimeout, Min-Heap Scheduling & Drift — Node.js Internals & Backend Services
- Native Compression: node:zlib & Streaming Codecs — Node.js Internals & Backend Services