Blocking vs Non-Blocking I/O — What's the Difference?
Blocking I/O halts the calling thread until an operation (like a file read or network call) completes; non-blocking I/O returns immediately, letting the prog...
Published October 6, 2026
Blocking I/O halts the calling thread until an operation (like a file read or network call) completes; non-blocking I/O returns immediately, letting the program continue and check on or be notified about the result later.
Why they differ
- Blocking I/O is simpler to write and reason about, since code executes in the exact order it's written
- Non-blocking I/O allows a single thread to handle many concurrent operations without needing a dedicated thread per operation, at the cost of more complex control flow
How to choose
- Blocking I/O is fine for simple scripts or low-concurrency scenarios
- Non-blocking I/O (often paired with an event loop) is preferred for servers handling many simultaneous connections efficiently, like Node.js or Nginx
FAQ
Is async/await blocking or non-blocking?
Non-blocking — async/await is syntax that makes non-blocking code easier to read and write, but under the hood the operation still doesn't block the underlying thread while waiting.