liveBook · Manning

Compute-bound

As explained in Grokking Concurrency

A CPU-bound operation is a computational operation whose execution is primarily limited by processor computation rather than input/output or other resources.

A task is CPU-bound when processor computation is its main bottleneck: a faster CPU could make it finish sooner. Unlike an I/O-bound task, it spends most of its time computing rather than waiting for devices or services. section 6.1 section 6.2

Common CPU-bound work includes:

  • Mathematical operations, such as matrix multiplication. section 6.2
  • Encryption, image and video processing, sorting, and searching. section 6.2

Computing versus waiting

Multiplying two enormous matrices keeps the processor busy, so more CPU capacity may help. Writing a large network transfer to disk spends much of its time waiting; adding processor cores alone may not speed it up. section 6.4

In a game, calculating the changing world is CPU-bound, while taking player input and rendering the screen are I/O-bound. Multitasking can interleave such work, but switching between tasks has a cost; CPU-bound work may benefit from parallelism when multiple cores are available. section 6.5 section 6.14

How Grokking Concurrency covers it

How deep it goes
Defines CPU-bound work, lists examples, and relates processor speed and cores to performance without detailing processor internals.
Examples
Uses matrix multiplication, network-to-disk transfer, computational algorithms, and an arcade game's world calculation.
What you can do after
Evaluate whether processor speed or additional cores could help a workload by identifying its main bottleneck.
How it connects
Contrasts CPU-bound work with I/O-bound work and connects both to multitasking, context switching, and parallelism.

Also explained in

Compare how 5 books explain compute-bound →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Concurrency. The section links point to the parts of the book it draws on.