CPU Bound versus I/O Bound etc.

When looking at optimization it’s helpful to think of the components that go into a computer and what their different relative speeds are.

  • CPU

    • The central processing unit is lightning fast relative to every other component. It can perform a huge number of operations per second. Mentally it’s easy to think about the tiny distances that electrons have to go around a wafer of silicon

  • Memory

    • Memory is an order of magnitude slower - if you think about it, physically memory is miles away from the tiny wafer of silicon that is the CPU. Electrons have to move much further for information to flow between the CPU and the memory on a mother board.

  • Persistent storage like hard discs and solid state drives

    • Another order of magnitude slower - in the case of hard drives physical components have to move for data to be read or written.

  • Network operations

    • Again very slow - electrical currents have to travel a much further distance

So when we say a process is “CPU bound” it indicates something that is only held up by the capacity of the CPU - typically that would be something very computationally intensive like cryptography. Whereas a process which is I/O bound is held up by the speed of input/output.

See Optimizing Input and Output by Writing in Large Chunks.