Overview

Concurrency in computer science refers to writing and running computations so that multiple tasks make progress during overlapping time intervals. Rather than insisting that only one operation happens at a time, concurrent designs allow interleaving or independent advancement of threads, processes, or tasks. The general approach to structuring and executing such programs is often described as concurrency and covered in many programming and systems resources: concurrency concepts.

Key characteristics

Concurrent systems are characterized by nondeterministic ordering of events, context switching, and the need for coordination between units of execution. Common execution units include operating system processes, threads within a process, lightweight tasks, and actors. Concurrency emphasizes progress and composition—multiple activities can be active, waiting, or blocked while the system continues overall work.

History and models

Early operating systems introduced multitasking and time-sharing to support concurrent use of a single processor. Over time, programming languages and libraries evolved a range of models to express concurrency: shared-memory threads with synchronization primitives, message-passing models such as actors and Communicating Sequential Processes (CSP), and event-driven or asynchronous I/O patterns. Modern language features like futures, promises and async/await simplify expressing concurrent flows.

Uses and examples

Concurrency is widely used to build responsive user interfaces, network servers that handle many clients simultaneously, real-time and embedded controllers, and pipelines that overlap I/O with computation. For example, a web server may process multiple requests concurrently so that slow I/O on one connection does not block others, improving throughput and latency.

Techniques and common challenges

  • Synchronization: locks, mutexes, semaphores, condition variables.
  • Communication: shared memory vs message passing; immutability to reduce contention.
  • Correctness issues: race conditions, deadlock, livelock, starvation, and memory consistency.
  • High-level approaches: actor model, transactional memory, lock-free algorithms, event loops, and structured concurrency.

Distinctions and practical advice

Concurrency is often contrasted with parallelism: parallel computing runs multiple operations truly simultaneously on multiple processors, while concurrency is about managing multiple logical activities that may or may not execute at the same time (parallel computing). Effective concurrent design balances correctness and performance: prefer small critical sections, minimize shared mutable state, adopt higher-level abstractions, and apply testing and verification techniques because nondeterminism makes bugs harder to reproduce.