π Concurrency & Parallelism
Doing many things at once. 51 topics, from beginner to advanced.
Concurrency and parallelism are about running multiple tasks at once. Concurrency structures a program to handle many tasks that may overlap in time, while parallelism runs them literally at the same time on several cores. This area covers threads, locks, race conditions, deadlocks and the asynchronous models used in modern servers and user interfaces.
Who this area is for
Developers writing servers or any program that must do several things at once, and engineers tuning multi-core performance.
Real-world use cases
- Handling thousands of network connections in one web server without a thread for each.
- Splitting a large matrix multiplication across all CPU cores.
- Keeping a user interface responsive while a file downloads in the background.
- Handling thousands of network connections in one server without a thread for each.
- Splitting an image-processing job across all the cores of a laptop.
Topics in Concurrency & Parallelism
Beginner (17)
- Concurrency vs Parallelism β Interleaved progress versus simultaneous execution.
- Sequential Bottlenecks β Serial portions limiting overall speedup.
- Amdahl's Law β Formula bounding speedup by the serial fraction.
- Threads in Practice β Creating and joining threads in programs.
- Thread Pools β Reusing a fixed set of worker threads.
- Thread Safety β Code behaving correctly when called from multiple threads.
- Shared State Hazards β Bugs from unsynchronized access to common data.
- Locks in Practice β Using mutual exclusion correctly.
- Read-Write Locks β Locks allowing many readers or one writer.
- Condition Variables β Waiting threads signaled when state changes.
- Producer-Consumer Pattern β Threads exchanging work through a shared buffer.
- Atomic Operations β Indivisible hardware-supported updates.
- Compare-and-Swap β Primitive updating a value only if unchanged.
- Memory Barriers β Instructions constraining reordering of memory operations.
- Volatile and Visibility β Ensuring one thread's writes are seen by others.
- Starvation and Livelock β Tasks never progressing despite not being blocked.
- Priority Inversion β Low-priority task blocking a high-priority one.
Intermediate (17)
- Async/Await β Syntax writing asynchronous code in sequential style.
- Event-Driven Concurrency β Single-threaded handling of many tasks via an event loop.
- Coroutines β Functions that suspend and resume cooperatively.
- Futures and Promises Model β Handles for results computed elsewhere.
- Green Threads β User-space scheduled lightweight threads.
- Actor Model β Isolated entities communicating by messages.
- Communicating Sequential Processes β Concurrency via channels between processes.
- Go Goroutines and Channels β Lightweight tasks communicating through typed channels.
- Lock-Free Data Structures β Structures coordinating via atomics instead of locks.
- Wait-Free Algorithms β Guarantees that every operation finishes in bounded steps.
- ABA Problem β Hazard when a value changes and changes back unnoticed.
- Software Transactional Memory β Treating memory updates like database transactions.
- Data Parallelism β Applying the same operation across partitions of data.
- Task Parallelism β Running different tasks at the same time.
- Fork-Join Model β Splitting work into subtasks then merging results.
- Parallel Reduction β Combining many values using a tree of operations.
- Parallel Prefix Sum β Scan primitive computing running totals in parallel.
Advanced (17)
- OpenMP β Directive-based shared-memory parallel programming.
- MPI β Message-passing interface for cluster programming.
- CUDA Programming β NVIDIA's model for general-purpose GPU computing.
- GPU Memory Hierarchy β Global, shared and register memory on GPUs.
- Parallel Sorting β Sorting algorithms designed for many processors.
- Load Balancing in Parallel Programs β Distributing work evenly to avoid idle workers.
- False Sharing β Performance loss when threads modify data on one cache line.
- NUMA β Memory architecture with non-uniform access times.
- Parallel Graph Algorithms β Adapting traversals and shortest paths to many cores.
- Concurrency Testing β Finding timing bugs with stress and model checking.
- Deterministic Parallelism β Designs ensuring reproducible results.
- Reactive Programming β Programming with asynchronous data streams.
- Backpressure β Signaling producers to slow when consumers lag.
- Linearizability β Correctness condition making operations appear atomic.
- Memory Models in Languages β Java and C++ rules for concurrent memory behavior.
- Hardware Transactional Memory β CPU support for optimistic atomic regions.
- Performance Scaling Analysis β Measuring speedup and efficiency as cores increase.
How to study Concurrency & Parallelism
Write a program with two threads that update one counter. Run it many times, observe the wrong results, then fix it with a lock or an atomic operation. Then read the memory-model topics to explain why the bug happened.
Frequently asked questions
What is the difference between concurrency and parallelism?
What is a race condition?
What causes a deadlock?
Does more threads always mean faster code?
Why is concurrency bug-prone?
Open the interactive Concurrency & Parallelism area Take the Concurrency & Parallelism quiz
Other areas
- π» Programming Fundamentals
- π§± Data Structures
- βοΈ Algorithms
- π Computer Architecture & Logic
- π₯οΈ Operating Systems
- π Computer Networks
- ποΈ Databases
- ποΈ Software Engineering
- πΈοΈ Web Development
- π Security & Cryptography
- β Theory & Discrete Math
- 𧬠Languages & Compilers
- π€ AI & Machine Learning
- βοΈ Distributed Systems & Cloud
- π¨ Graphics, Vision & Media
- π Math for Computing
- π± Mobile, Embedded & IoT
- π οΈ DevOps & Tooling
- π Emerging & Frontier Topics