← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Concurrency vs Parallelism

concurrency Beginner
debt(d7/e5/b7/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The term's detection_hints show automated: no — there's no static tool that can detect whether you've confused concurrency with parallelism. You discover the mistake through performance profiling, load testing, or careful architectural review. The choice manifests as 'async doesn't speed up my CPU-bound task' which only surfaces under realistic production load.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix indicates a conceptual shift (I/O-bound → async, CPU-bound → parallelism), but implementing this typically means refactoring how work is dispatched. Changing from async coroutines to worker processes or queue-based parallel jobs affects job dispatching, result collection, and error handling — a significant but localised architectural change.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7). The applies_to shows this spans web, cli, and queue-worker contexts — the decision shapes how your entire application handles workload. Choosing the wrong model (async for CPU-bound, or sequential for I/O-bound) creates persistent drag: every performance optimization attempt must work around the fundamental mismatch. Not quite b9 because you can carve out subsystems that use the correct model.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception explicitly states developers conflate concurrency and parallelism as 'the same thing.' This contradicts how similar concepts work elsewhere — in languages like Go or Node.js, the distinction is more visible. The common_mistakes reinforce this: developers assume async gives parallelism, or that multi-process automatically means parallel execution regardless of CPU cores. A competent developer from single-threaded backgrounds will guess wrong.

About DEBT scoring →

TL;DR

Concurrency is about dealing with multiple tasks at once (structuring); parallelism is actually executing multiple tasks simultaneously (hardware). You can have one without the other.

Explanation

Concurrency: multiple tasks make progress over time, potentially interleaved on one core. Parallelism: tasks execute at the exact same instant on multiple cores/machines. PHP FPM: parallelism (multiple processes on multiple cores) but no shared memory concurrency within a request. Node.js: concurrency (event loop) but single-threaded (no parallelism except worker_threads). Go: both — goroutines for concurrency, GOMAXPROCS for parallelism. CPU-bound tasks need parallelism. I/O-bound tasks benefit from concurrency (async). Rob Pike: 'Concurrency is about structure, parallelism is about execution.'

Common Misconception

Concurrency and parallelism are the same thing — concurrency is a design concern (how tasks are structured); parallelism is an execution concern (multiple CPUs). Async code is concurrent but not necessarily parallel.

Why It Matters

Confusing the two leads to wrong architectural choices — async (concurrency) solves I/O-bound bottlenecks; parallel processes/threads solve CPU-bound bottlenecks.

Common Mistakes

  • Using async for CPU-bound tasks — async adds overhead without true parallelism.
  • Assuming multi-process = parallelism — it is, but also requires multiple CPU cores.
  • Not knowing PHP-FPM is parallel (multiple processes) but each request is sequential.

Code Examples

✗ Vulnerable
// Async for CPU-bound (wrong tool):
async function compressImage(img) {
    await heavyCpuCompression(img); // Blocks event loop — should use Worker
}
✓ Fixed
// Node: Worker for CPU-bound:
const { Worker } = require('worker_threads');
new Worker('./compress.js', { workerData: img });

// PHP: FPM workers ARE parallel (multiple processes)
// For async I/O: Swoole coroutines
// For CPU: pcntl_fork or queue + multiple worker processes

Added 23 Mar 2026
Views 41
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 1 ping S 1 ping S 0 pings M 0 pings T 2 pings W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 1 ping S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F
No pings yet today
No pings yesterday
Amazonbot 10 Perplexity 9 Unknown AI 4 Google 3 ChatGPT 2 Ahrefs 2
crawler 28 pre-tracking 2
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Low
⚡ Quick Fix
I/O-bound: use async/concurrency (coroutines, event loops). CPU-bound: use true parallelism (worker threads, multiple processes, distributed jobs).
📦 Applies To
web cli queue-worker
🔍 Detection Hints
Auto-detectable: ✗ No
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Low Context: File

✓ schema.org compliant