Introduction to Concurrency
Concurrency is a fundamental concept in computer science that allows multiple tasks or processes to make progress independently. It is the basis of responsive UIs, high-throughput servers, and efficient use of modern multi-core CPUs.
Concurrency is not the same as parallelism:
- Concurrency — multiple tasks are in progress at the same time (they may take turns on one CPU)
- Parallelism — multiple tasks execute at the exact same instant on multiple CPU cores
An event loop handling 10,000 connections on one thread is concurrent but not parallel. Four threads crunching different sections of a matrix are parallel.