Technopedia

The technologist’s encyclopedia

Concurrency

Concurrency studies how to coordinate multiple units of execution (threads, processes, goroutines) that share state or communicate. It is relevant whenever a program must exploit multiple cores, handle I/O without blocking, or coordinate independent workers.

Concurrency is the structure of a program: it describes how multiple units of work are organized and may interleave. Parallelism is the execution: it is the simultaneous execution of multiple units on multiple cores. A program can be concurrent without being parallel (interleaved on one core), and parallel without being concurrent (embarrassingly parallel, no coordination needed).

History

Classes

PageCore objectKey metricBoundary
Operating systemProcesses, threads, CPU cores, preemptionContext-switch cost, degree of parallelismExecution substrate on which the three coordination classes run; it provides the units of execution but does not model coordination logic itself
ParallelismScheduler (job/worker, M:N), thread pool, lock/mutex, semaphore, fork/join, race conditions, deadlockContention, throughput, deadlock freedomShared-state coordination; does not model I/O or inter-process communication
AsynchronyEvent loop, async/awaitLatency, throughput on a single coreNon-blocking I/O; does not model shared state or multi-core parallelism
Message passingCSP, channels, map/reduce, event sourcingMessage throughput, ordering guaranteesCommunication without shared state; does not model the physical network

How the classes fit together: the operating system is the substrate — it supplies the processes, threads, and cores that every other class runs on. On top of it, parallelism and message passing are the two alternative coordination strategies for multiple cores (shared mutable state versus communicating private state), while asynchrony is the single-core strategy for I/O-bound workloads; asynchrony and message passing combine naturally, since an event loop is often driven by incoming messages.

Authoritative sources