Docerity

Concurrency

Multiple chefs sharing one kitchen

June 15, 2026 · 5 min read

ConcurrencyPerformance

The problem: one slow task blocking everything else

If your system handles one task completely before starting the next, a single slow task — a big file upload, a slow network call — holds up every task behind it, even ones that have nothing to do with it and could easily run in the meantime.

Like this

One chef, one dish at a time: if the sauce needs to simmer for twenty minutes, everyone else's order waits, even the one that's just toast.

What concurrency actually means

Concurrency means multiple tasks make progress over the same stretch of time, by interleaving — working on one, stepping away while it waits on something (like the network or a disk), and picking up another in the meantime. This is different from true parallelism, where tasks run on genuinely separate CPU cores at the same instant; concurrency can happen even on a single core.

Like this

Multiple chefs, one kitchen: while one dish simmers untouched, that chef starts prepping the next order instead of standing there watching the pot.

The catch: shared resources

The moment two tasks touch the same shared thing — a variable, a file, a database row — at the same time, you risk a race condition: the outcome depends on timing you don't control, and it can be different every run. This is why concurrent systems need rules for who gets to touch what, and when.

Like this

Two chefs reaching for the same single stove burner at once, each assuming it's free — someone's dish gets ruined, and which one depends on pure timing.

Why it's worth the complexity

Done well, concurrency means your system keeps serving other users while one slow operation is still in flight, instead of everyone waiting in a single-file line behind it.

Like this

A kitchen with three chefs sharing tasks sensibly gets vastly more tables fed per hour than one chef working alone — even with the same one stove.

Got a concept you want explained like this?

Ask me about it

New explainers, straight to your inbox

One email whenever a new concept goes up. No spam, unsubscribe anytime.