Concurrency Models

A concurrency model is a language-level answer to a hard question: when several computations must make progress at once, how should a program say so, and what should the language guarantee about how they interact?

11 frameworks, from 1965 to today · Programming Languages · Computer Science

still a working view ended · each leads to its entry below

Overview

A concurrency model is a language-level answer to a hard question: when several computations must make progress at once, how should a program say so, and what should the language guarantee about how they interact1? The stakes are practical. Two threads incrementing the same counter, two processes sharing a file, or a server handling thousands of connections at once can all go wrong in ways that are invisible in the source text1. Each model in this history is a different bargain about who bears the burden of getting it right—the programmer, the runtime, or the type checker—and what kinds of mistakes the language makes impossible rather than merely unlikely.

Locks and the shared-memory bargain

The earliest and still most widespread model is shared-memory concurrency with locks. Threads of one program read and write the same memory, and a lock (or mutex) is a token that only one thread may hold at a time; a thread acquires it before touching shared data and releases it after23. The model descends from operating-system design of the 1960s, when Edsger Dijkstra formalized the semaphore in 1965—a counter with two atomic operations, one that waits until the counter is positive and decrements it, one that increments it. Semaphores made it possible to reason about mutual exclusion and to build classic patterns such as the bounded buffer, where producers and consumers meet.

Locks are simple to state and hard to use. A program that forgets to release a lock deadlocks; one that acquires two locks in different orders in different threads deadlocks too; one that guards some but not all accesses to a variable has a data race, an unsynchronized access whose result depends on timing1. Tony Hoare's 1974 paper "Monitors: An Operating System Structuring Concept" attacked the second problem by bundling data with the lock that protects it. A monitor is a module whose procedures are executed under mutual exclusion automatically, plus condition variables on which a thread can wait until another signals that a state has changed4. Hoare's formulation, and a variant by Per Brinch Hansen, became the basis of the synchronized methods of Java (1995) and of monitor libraries in many later languages4. The bargain was clear: the language enforces exclusion, but the programmer must still get the waiting and signalling logic right, and condition variables are notoriously easy to misuse.

Message passing: actors and processes

A rival tradition rejected shared memory altogether. In 1973, Carl Hewitt, Peter Bishop, and Richard Steiger at MIT proposed the actor model: computation consists of actors that hold private state and communicate only by sending asynchronous messages; in response to a message an actor may send messages, create new actors, or change its own behavior. Because no state is shared, there are no locks and no data races—the hazards of the lock model simply cannot be expressed. The model was influential as a theory of computation and, later, as an engineering pattern: Erlang, developed at Ericsson from the mid-1980s for telephone switches, built its concurrency on lightweight processes that share nothing and communicate by message, with failure handled by supervisors that restart crashed processes. Erlang's "let it crash" philosophy treats failure as normal and isolation as the primary safety property.

Hoare's 1978 paper "Communicating Sequential Processes" (CSP) offered a different message-passing discipline5. Processes communicate over named channels, and communication is synchronous: a send and its matching receive happen together, as a single event5. This makes channels themselves the synchronization mechanism, and it permits a style of reasoning in which a program's behavior is described by the sequences of events its processes can engage in. CSP influenced the Occam language for transputers in the 1980s and, much later, the channel constructs of Go (2009), whose designers cited CSP directly. Go's channels are typically buffered or used with select, so the correspondence is a family resemblance rather than an identity, but the slogan "do not communicate by sharing memory; share memory by communicating" states the CSP inheritance plainly.

Dataflow and the declarative turn

A third strand asked what happens if the programmer never names an order of execution at all. In dataflow concurrency, a computation is a graph of operations connected by data dependencies; an operation runs as soon as its inputs are available, and the language or runtime decides the schedule67. Jack Dennis and colleagues at MIT developed dataflow architectures and languages from the late 1960s and 1970s, and the idea surfaced in many forms: Lucid (1976), a dataflow language for reasoning about streams; the futures of Multilisp, introduced by Robert Halstead in 1985, where a future is a placeholder for a value being computed elsewhere and touching it blocks only if the value is not ready; and the promise of later languages, the same idea under another name. Dataflow's appeal is that it exposes parallelism without exposing races—dependencies, not statements, determine order—but its cost is that some computations, especially those with mutable state or interactive input, are awkward to express as pure graphs.

The event loop and the single-threaded answer

Meanwhile, a very different model grew out of interactive systems. An event loop is a single thread that repeatedly takes the next event from a queue and runs a callback—a function registered in advance to handle that kind of event89. The model avoids locks entirely because only one callback runs at a time, and it scales to many connections because waiting is cheap: while a callback waits for I/O, the loop runs other callbacks. It became the backbone of graphical user interfaces and, from the late 2000s, of server-side JavaScript through Node.js (2009), which paired the loop with non-blocking I/O. The cost is callback hell: sequences of dependent asynchronous steps nest into unreadable pyramids, and a single slow callback stalls everything.

Transactions and the memory question

In the 1980s, database systems had solved a version of the concurrency problem with transactions: a group of operations that either all take effect or none does, with the system guaranteeing isolation between concurrent transactions. Could the same idea be brought into ordinary memory? Maurice Herlihy and J. Eliot B. Moss proposed transactional memory in 1993 as an architectural feature; Nir Shavit and Dan Touitou gave a software-only version, software transactional memory (STM), in 1995. In an STM language, the programmer marks a block as atomic; the runtime executes it optimistically and retries if another transaction conflicts10. The promise was that programmers could stop reasoning about locks and instead reason about atomic blocks, and that the runtime could exploit parallelism the programmer never had to specify. STM was implemented in research languages and libraries (Haskell's STM, Clojure's refs) and generated a large literature, but it never displaced locks in mainstream practice: overhead, the difficulty of mixing transactions with I/O, and the fact that retries can be unbounded kept it a specialized tool.

Async/await and structured concurrency

The callback problem found its answer in the 2010s. C# 5.0 (2012) introduced async and await: a method marked async can await a future, and the compiler rewrites it into a state machine that suspends at the await and resumes when the value arrives, so asynchronous code reads like ordinary sequential code11. The idea spread to JavaScript (2017), Python (2015), Rust (2019), and others11. It solved readability, but it created a new hazard: a task started and never awaited can outlive the scope that created it, leak, or fail silently.

Structured concurrency is the response. The term was popularized by Martin Sústrik and by Nathaniel J. Smith's 2018 essay "Notes on structured concurrency," which argued that concurrent tasks should be scoped like blocks: a construct that starts child tasks must not return until all children have finished, and cancellation propagates outward. The idea echoes the structured-programming movement's insistence that control flow have a single entry and exit, applied to tasks rather than statements12. It appears in Kotlin's coroutines, in Python's asyncio.TaskGroup (2022), and in Java's structured concurrency previews.

Types that make races unrepresentable

The most recent turn asks the type system to carry the burden. Rust's ownership and borrowing rules, designed by Graydon Hoare from 2006 and stabilized with Rust 1.0 in 2015, are not a concurrency model in themselves, but they yield one13. Ownership says each value has one owner; borrowing lets other code use it temporarily under rules the compiler checks13. The payoff for concurrency is that the compiler can prove at compile time that data shared between threads is either immutable or exclusively owned, so data races become compile errors rather than runtime bugs13. The same logic underlies the Send and Sync traits, which mark which types may cross thread boundaries. The bargain is strict: some programs that would be correct are rejected, and the programmer must restructure code to satisfy the checker.

Where the field stands

Today the models coexist rather than compete for a single crown. Locks and monitors remain the default in Java, C++, and C#; actors and CSP-style channels dominate in Erlang, Elixir, and Go; event loops and async/await underpin JavaScript, Python, and Rust's asynchronous ecosystem; STM survives in Haskell and Clojure; and ownership typing has made Rust a reference point for memory-safe concurrency. The open questions are the old ones in new dress: how to make cancellation and failure propagation as reliable as structured concurrency promises; whether type systems can express more concurrency invariants without becoming unusable; and how to give programmers the performance of shared memory without its hazards. Each historical model answered one of those questions well and left another to its successors.

References

  1. Concurrent computing (introduction, Coordinating access to shared resources, Issues), Wikipedia
  2. Lock (computer science), Wikipedia
  3. Thread (computing), Wikipedia
  4. Monitor (synchronization) (introduction, History), Wikipedia
  5. Communicating sequential processes, Wikipedia
  6. Dataflow programming, Wikipedia
  7. Dataflow architecture, Wikipedia
  8. Event loop, Wikipedia
  9. Callback (computer programming), Wikipedia
  10. Transactional memory (Software transactional memory), Wikipedia
  11. Async/await (History), Wikipedia
  12. Structured concurrency, Wikipedia
  13. Rust (programming language), Wikipedia

The frameworks of Concurrency Models

Each framework is a way of working the field has used: when it held, and the question it answers.

  1. 1965-Present
  2. 1970-Present

    Dataflow programming

    What order should computations run in?

    Fly to its tower in Nousfarer

  3. 1973-Present

    Actor Model

    How can independent processes communicate without sharing state?

    Fly to its tower in Nousfarer

  4. 1974-Present

    Monitors

    How can shared data be protected automatically?

    Fly to its tower in Nousfarer

  5. 1978-Present

    Communicating Sequential Processes

    How should processes communicate over channels?

    Fly to its tower in Nousfarer

  6. 1980-Present

    Event loop

    How can one thread handle many events?

    Fly to its tower in Nousfarer

  7. 1985-Present

    Futures and Promises

    How can a program refer to a value not yet computed?

    Fly to its tower in Nousfarer

  8. 1993-Present

    Transactional Memory

    Can memory updates be made atomic without locks?

    Fly to its tower in Nousfarer

  9. 2012-Present

    Async/Await

    How can asynchronous code read like sequential code?

    Fly to its tower in Nousfarer

  10. 2015-Present

    Ownership and Borrowing Typing

    Can the compiler prove concurrent access is safe?

    Fly to its tower in Nousfarer

  11. 2018-Present

    Structured Concurrency

    How should concurrent tasks be scoped and cancelled?

    Fly to its tower in Nousfarer

How the ideas connect

Each arrow runs from an earlier idea to the later one it shaped. The list below says what passed between them.

Shared-Memory Concurrency with LocksDataflow programmingActor ModelMonitorsCommunicating Sequential ProcessesEvent loopFutures and PromisesTransactional MemoryAsync/AwaitOwnership and Borrowing TypingStructured Concurrency

Beyond the field

Where Concurrency Models's ideas came from in other fields, and what they led to there: the strongest 12 of 15 links.

A city in Nousfarer: a red-carpeted stair climbing terraces to a crowned tower on an acropolis, more towers round it, forest and snowy mountains beyond.
A city in Nousfarer, the game played in the browser.

Concurrency Models is a planet in Nousfarer

Its city has a tower for each of these 11 frameworks. Land, walk in, and climb one concept at a time.

Land on Concurrency Models

Related fields

Fields its ideas are linked to

More in Programming Languages

See where Concurrency Models sits on the Map of Human Knowledge