Skip to main content

Why are I/O operations considered slow?

I/O operations are considered "slow" because they depend on external devices or networks, not on the processor. "Slow" here means slow compared to operations in RAM or the CPU.

1. What happens during I/O

When a program, say, reads a file:

  1. The processor hands the operating system a request: "read data from disk".
  2. The OS passes the task to a device driver.
  3. The physical disk (SSD or HDD) has to:
  • locate the right sector,
  • read the data,
  • pass it back through the system bus into memory.
  1. Only then does the program get the result.

This can take milliseconds, which for the CPU is an eternity (since the processor operates in nanoseconds).

2. Typical examples of "slow" I/O

I/O typeAverage latencyWhy it's slow
Disk (HDD/SSD)millisecondsphysically reading data off the media
Network (HTTP, TCP)milliseconds → secondswaiting for network transfer, a server response
Databasemillisecondsnetwork delays + running the query on the database side
Filesystemmillisecondstalking to the OS, accessing file descriptors

3. Comparison with CPU and memory

Operation typeTime (roughly)
CPU (arithmetic, memory)nanoseconds (10⁻⁹ s)
RAM operationstens of nanoseconds
An SSDhundreds of microseconds → milliseconds
An HTTP requestmilliseconds → hundreds of milliseconds

That's a difference of millions of times between computing in memory and reading from disk/network.

4. Why this matters in Node.js

Node.js is single-threaded. If I/O operations ran synchronously (blocking), then:

  • the thread would be stuck waiting on the disk or network;
  • other requests would hang until the operation finished.

That's why Node.js uses non-blocking asynchronous I/O, operations run in the background, and once ready, they trigger a callback (through the Event Loop).

Summary

I/O operations are considered slow because they require interacting with external devices or networks, where delays (milliseconds) are orders of magnitude larger than in-memory operations (nanoseconds). Node.js solves this with asynchronous, non-blocking I/O, so it never sits idle while waiting.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.