Threads & Concurrency Models

concurrency vs parallelism

Picture one barista taking three coffee orders. They start the espresso machine, and while it pulls a shot they steam milk for a second order and ring up a third — one person, juggling, switching back and forth so all three drinks make progress. That is concurrency: dealing with many tasks at once by interleaving them. Now picture three baristas, each making one drink at the same instant. That is parallelism: actually doing many tasks at the same time. The crucial point for beginners is that these are different ideas — one is about structure (handling many things), the other is about execution (literally doing many things at once).

In computing terms: concurrency means several tasks are in progress over the same period, but on a single core the CPU is really only running one at a time, rapidly switching among them. From the outside it looks simultaneous, the way a juggler keeps several balls in the air with only two hands. Parallelism means the tasks are genuinely executing in the same instant, which requires more than one execution unit — typically several CPU cores. You can have concurrency without parallelism (one core, many interleaved threads), and you usually need concurrency in your program design before parallelism can help. A program is concurrent if it is structured as independent tasks; it runs in parallel only if the hardware lets several of those tasks proceed at the very same moment.

Why keep them straight? Because they solve different problems and have different limits. Concurrency improves responsiveness and lets you overlap waiting (like waiting for a disk or network) with useful work, even on one core. Parallelism improves raw throughput for compute-heavy work, but only up to the number of cores you have, and only for work that can be split. Confusing the two leads to false expectations — for example, expecting a program to run twice as fast just because you added threads, when the machine has only one core, or the task cannot be divided.

Downloading ten files concurrently on a single-core laptop is genuinely useful: while one download waits on the network, the CPU switches to handling another, so the overall wait shrinks. But summing a billion numbers does not get faster from concurrency alone on one core — it needs parallelism (several cores each summing a chunk) to truly speed up.

Concurrency = dealing with many things; parallelism = doing many things at once.

Concurrency is a property of how a program is structured; parallelism is a property of how it runs on hardware. You can have one without the other, and concurrency on a single core never adds true simultaneous computation.

Also called
concurrency versus parallelism並發與平行concurrent vs parallel