Concurrency (computer science)

Edit · View history

Concurrency (computer science)

Concurrency in computer science is the ability of a system to execute multiple tasks or processes in overlapping time intervals, but not necessarily simultaneously. It is a fundamental concept in operating systems, databases, distributed computing, and multithreaded programming. Concurrency enables programs to handle multiple events, improve resource utilization, and increase throughput, but introduces challenges such as race conditions, deadlocks, and livelocks.

Concurrency differs from parallel computing: parallelism strictly requires simultaneous execution (often on multiple processors), whereas concurrency is about managing multiple tasks that may interleave on a single core. A system can be concurrent but not parallel — for example, a single-core processor running multiple threads via time‑slicing.

Key concepts

History

The study of concurrency began in the 1960s with the advent of time‑sharing operating systems, where multiple users interacted with a single computer concurrently. Pioneering work by Edsger Dijkstra introduced semaphores and the concept of mutual exclusion (1965). C.A.R. Hoare’s Communicating Sequential Processes (1978) and Robin Milner’s Calculus of Communicating Systems later formalized concurrent computation.

In the 1990s, the rise of multithreading in mainstream operating systems and programming languages (e.g., Java’s built‑in threads) made concurrency a practical concern for everyday developers. The explosion of multi‑core processors in the 2000s shifted focus toward exploiting parallelism while still managing concurrency safely.

Challenges and approaches

Concurrent programs are notoriously difficult to design and debug due to non‑deterministic execution. Common pitfalls include priority inversion, resource starvation, and memory consistency issues. Solutions range from low‑level locking primitives to high‑level actor models (e.g., Erlang) and software transactional memory (e.g., in Clojure).

Many languages now offer built‑in concurrency abstractions, such as goroutines in Go or async/await in Python and JavaScript.