# Concurrency and Parallelism

Concurrency structures overlapping work, while parallelism executes multiple pieces of work at the same instant.

- Type: term
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-24
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/concurrency-and-parallelism/>)

## What it means

Concurrency is the composition and coordination of multiple tasks whose execution can overlap; parallelism is simultaneous execution on multiple processing resources. A system can be concurrent on one processor by interleaving tasks, and concurrent design can enable but does not guarantee faster parallel execution.

## Why it matters

Digital products handle many requests, background tasks, and external waits. Distinguishing concurrency from parallelism helps teams reason about responsiveness, throughput, capacity, data races, and why adding workers or processors may not make a sequential or highly contended workload faster.

## When to use it

Use concurrent structure when independent activities must make progress despite waiting or variable timing. Use parallel execution when work can be divided safely and measurement shows additional compute improves the relevant outcome. Sequential code is preferable when tasks are ordered, small, or coordination cost dominates.

## How it works

1. Identify tasks that can overlap and the state or resources they share.
2. Choose coordination mechanisms such as queues, immutable messages, locks, or structured tasks.
3. Set concurrency limits to protect memory, connections, dependencies, and fairness.
4. Run eligible work across available processors when parallel execution is beneficial.
5. Test race conditions, cancellation, ordering, and failure propagation under realistic load.
6. Measure throughput and latency because scheduling and coordination can erase expected gains.

## A practical example

A document service concurrently fetches metadata and permissions while waiting on storage, improving response time even on limited compute. Thumbnail generation is separately parallelized across CPU cores, but worker count is capped after measurements show contention beyond eight workers.

## Where it breaks

Concurrent systems are harder to reason about and reproduce. Shared state creates races and deadlocks; parallel work adds scheduling and communication overhead. Performance depends on workload, dependencies, runtime, hardware, and safe resource limits.

## Common mistakes

- Using concurrency and parallelism as synonyms.
- Increasing worker counts without limits on downstream connections or memory.
- Sharing mutable state without a clear synchronization or ownership model.
- Assuming more processors will accelerate inherently sequential work.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/concurrency-and-parallelism/#visualization-concurrency-and-parallelism>)

## Sources

1. [Concurrency Is Not Parallelism](<https://go.dev/blog/waza-talk>) — The Go Programming Language · Official technical explanation
2. [Go Concurrency Patterns](<https://go.dev/talks/2012/concurrency.slide>) — The Go Programming Language · Official technical presentation

## Related topics

- [Synchronous and Asynchronous Processing](<https://wiki.soroush.uk/topic/synchronous-and-asynchronous-processing/>)
- [Background Job](<https://wiki.soroush.uk/topic/background-job/>)
- [Browser Event Loop](<https://wiki.soroush.uk/topic/browser-event-loop/>)
