Python CPU-Bound vs I/O-Bound — ELI5

Imagine you’re making pizza. There are two kinds of slowness.

Waiting slowness: You put the pizza in the oven and stand there doing nothing for 15 minutes. The oven is doing the work. You’re just waiting. That’s I/O-bound — your program spends most of its time waiting for something else (a website to respond, a file to load, a database to answer).

Thinking slowness: You have to hand-knead dough for 200 pizzas. Your arms are doing all the work. No amount of waiting helps — you need more hands. That’s CPU-bound — your program is crunching numbers, processing images, or calculating things as fast as the processor can go.

Why does this matter? Because the fix is different for each one.

For waiting slowness, the trick is to do other things while you wait. Put the pizza in the oven, then start chopping vegetables. In Python, this means using async or threading — letting the program handle other tasks during the wait.

For thinking slowness, the trick is to get more workers. Ask friends to knead dough with you. In Python, this means using multiple processes (not threads, because of a thing called the GIL that makes threads take turns on thinking work).

Picking the wrong fix wastes your time. Adding threads to a math-heavy program barely helps. Using multiple processes for a program that just waits for web responses adds complexity for no gain.

The one thing to remember: if your program is slow because it’s waiting, overlap the waits; if it’s slow because it’s thinking, add more thinkers.

pythonperformanceconcurrency

See Also