Skip to content

I/O-bound and CPU-bound work

Category: Foundations · Status: stub · Lessons: chapter 07, Parallelism

One line: Work that spends its time waiting for disks and networks gains from concurrency even on one core; work that spends its time computing gains only from parallelism.

Also called: I/O-bound, CPU-bound.

How it connects

In each language

Rust tokio::task::spawn_blocking moves blocking work off the async worker threads
Java Virtual threads ↗ suit tasks that spend most of their time blocked on I/O, not long CPU-intensive work
Python The threading docs advise multiprocessing or ProcessPoolExecutor for CPU-bound work, and threads for I/O-bound tasks, because of the GIL
C# Asynchronous programming scenarios ↗ separates I/O-bound work (await the I/O call) from CPU-bound work (await Task.Run)
Kotlin Dispatchers.IO is for offloading blocking I/O; Dispatchers.Default uses at most one thread per CPU core (at least two)
Erlang and Elixir A native function that cannot finish within a millisecond is marked dirty and runs on dirty CPU or dirty I/O schedulers ↗, apart from the ordinary ones

Where to read more