Concurrency

Threads, shared state, and the modern toolbelt โ€” the capstone after imperative and object-oriented programming.

The Illusion of Simultaneity

We teach programming as a strictly linear sequence โ€” one statement after another, one truth at a time โ€” and then hand students machines with a dozen cores and programs with hundreds of threads. This page is the bridgeโ€ฆ

The Shared Mutability Disaster

Concurrency bugs have a reputation for being mystical. They are not โ€” they are the entirely predictable consequence of one combination: state that is shared between threads and state that mutates . Either alone is safe.โ€ฆ

The Concurrent Toolbelt

Raw new Thread(...) is concurrency's goto : legal, occasionally necessary, and almost never the right first move. Modern platforms provide a toolbelt of higher abstractions that manage the dangerous parts for you. Thisโ€ฆ

Concurrency Gaps: Lessons from Building a Real Language

The rest of this section teaches concurrency through Java's standard toolbelt. This page is a companion from the other direction: what actually goes wrong when a language's concurrency support is incomplete, drawn fromโ€ฆ