til/applied-sciences/engineering/concurrency-vs-parallelism
concurrency-vs-parallelism.mdupdated 2026-07-223333 words
ダブルクリックで英日反転
Applied Sciences · Engineering

Concurrency vs parallelism

EN

They sound identical in Japanese (並行 / 並列) but name different things. Concurrency is about structure — dealing with many tasks in overlapping time by switching between them. Parallelism is about execution — actually running multiple tasks at the same instant, which needs multiple workers (CPU cores). Rob Pike's line: 'Concurrency is about dealing with lots of things at once; parallelism is about doing lots of things at once.'

Concurrency = structure

  • Concurrency = designing a program so many tasks make progress in overlapping periods, not necessarily at the same instant.
  • One worker can be concurrent: it starts task A, switches to task B while A waits, comes back to A — interleaving.
  • Possible on a single CPU core via time-slicing (rapidly switching). No second worker required.
  • It's about how you organise independent tasks, not about raw speed.

Parallelism = simultaneous execution

  • Parallelism = literally executing multiple tasks at the very same instant.
  • Requires multiple execution units — 2+ CPU cores, or multiple machines.
  • This is what actually makes wall-clock time shorter for CPU-heavy work.
  • Parallelism is one way to run a concurrent design fast; concurrency is the design that makes parallelism usable.

The café analogy (as a footnote)

  • Concurrency: one barista takes an order, starts the machine, takes the next order while coffee brews — juggling, one person.
  • Parallelism: two baristas each making a drink at the same moment — genuinely simultaneous.
  • So concurrency can exist without parallelism (1 barista juggling), and parallelism needs ≥2 workers.
  • In Claude Code workflows: parallel() queues many agents concurrently, but true parallelism is capped at (CPU cores − 2) — the rest wait their turn.
Concurrency is about structure (dealing with many tasks by interleaving); parallelism is about execution (running them at the same instant, needing multiple cores). A single core can be concurrent but never parallel.
応用科学 · エンジニアリング

並行と​並列の​ちがい

JP

日本語では​似て​見えるが​(並行=concurrency/並列=parallelism)、​指すものが​違う。​並行は​「構造」の​話——多数の​タスクを、​時間を​重ねながら​切り​替えて​進める​設計。​並列は​「実行」の​話——複数の​タスクを​本当に​同時に​走らせる​ことで、​複数の​働き手​(CPUコア)が​要る。​Rob Pike​(=Go言語の​設計者の​一人)の​言葉:​「並行とは​多くを​“さばく​”こと、​並列とは​多くを​“同時に​行う​”こと」。

並行​(concurrency)​=構造

  • 並行=多数の​タスクが、​重なり合う​時間の​中で​進むよう設計する​こと。​必ずしも​同一瞬間ではない。
  • 働き手が​1人でも​並行は​できる​:タスクAを​始め、​Aが​待ちの​間に​Bへ​切り​替え、​また​Aへ​戻る​——交互処理​(インターリーブ)。
  • CPUコアが​1つでも、​タイムスライス(=ごく​短時間で​切り​替える​方​式)で​実現できる。​2人目の​働き手は​不要。
  • 「独立した​タスクを​どう​組み立てるか」の​話で、​速度​その​ものの​話ではない。

並列​(parallelism)​=同時実行

  • 並列=複数の​タスクを、​文字どおり同一瞬間に​実行する​こと。
  • 複数の​実行単位が​必要——CPUコアが​2つ以上、​または​複数台の​マシン。
  • CPUを​多く​使う​処理で、​実時間​(=時計で​測った​時間)を​実際に​短く​するのは​これ。
  • 並列は​「並行設計を​速く​走らせる​一手段」。​並行と​いう​設計が​あってこそ、​並列が​活きる。

カフェのたとえ​(補足と​して)

  • 並行:1人の​バリスタが​注文を​受け、​マシンを​回し、​抽出を​待つ間に​次の​注文を​受ける​——1人で​やりくり。
  • 並列:2人の​バリスタが​同じ​瞬間に​それぞれ1​杯ずつ作る​——本当に​同時。
  • だから​並行は​並列なしでも​成立し​(1人の​やりくり)、​並列は​働き手2人以上が​要る。
  • Claude Codeの​ワークフローでは​:parallel() は​多数の​エージェントを​並行に​列に​並べるが、​真の​並列は​(CPUコア数−2)が​上限で、​残りは​順番待ちに​なる。
並行は​「構造」​(多数の​タスクを​切り替えてさばく​設計)、​並列は​「実行」​(同一瞬間に​走らせる​こと・複数コアが​必要)。​1コアは​並行には​なれるが、​決して​並列には​なれない。
148 notestil