Skip to content

10 — Resources

The primary sources

Every page here can be checked against these. Where a page says what a language promises, it links one of them rather than paraphrasing from memory.

Rust

Go

C

C++

Java

Python

Books

The concurrency books on the shelf beside this library, plus a few worth knowing that are not, grouped by the language they focus on. Each entry gives the author, publisher and year from the book's own title pages, its example code where the book names a repository, and its chapters — every chapter for a book about concurrency, only the concurrency chapters for a broader one. The concept pages cite the chapters that cover each concept, and each book lists the concepts that cite it.

Focus Books On the shelf Whole-book concurrency titles
General and cross-language 15 13 11
Rust 13 13 4
Go 10 10 3
C 8 8 2
C++ 10 10 9
Java 9 8 3
C# and .NET 7 7 5
Python 22 15 13
Haskell 3 3 1
Erlang and Elixir 8 8 2
Scala and functional programming 7 7 1
JavaScript 7 7 3
Swift 1 1 1
Other languages 7 7 3

Python concurrency books have a well-kept outside list too: Jason Brownlee's Python Concurrency Books ↗ on SuperFastPython, with each book's concurrency chapters.

The same topic in the sibling libraries

Each row is a topic, its concept pages, the lessons here that ask about it, and the pages in the language libraries that go deeper for one language. The concept pages carry the same links concept by concept.

Topic Concepts Here Rust Go Elsewhere
Starting a thread, and waiting for it Thread · Join · Goroutine Who waits when main returns? · Getting a result back Spawning a thread ↗ main does not wait ↗ · A goroutine has no handle ↗ · Goroutines are cheap ↗
A failure inside a thread Liveness failure · Lock poisoning chapter 01, planned Spawning a thread ↗ A panic ends the whole program ↗
Moving a value to another thread Channel · Unbuffered channel · Buffered and bounded channels chapter 05, planned Channels ↗ · Sharing across threads: Arc An unbuffered send waits for a receiver ↗ · A buffered channel is a bounded queue ↗ · Closing a channel ends a range ↗
Waiting on several things at once Select · Timeout chapter 05, planned select waits on many channels ↗ · select chooses at random ↗ · A timeout is a channel ↗
What may cross a thread boundary Send and Sync · Thread safety chapter 02, planned Send and Sync
Data races and lost updates Race condition · Data race · Race detector Is total += n safe on two threads? Data races ↗, for C and C++ programmers A mutex guards a counter ↗ · The race detector ↗ Python: The format mini-language ↗ — its n type can change the process's locale while other threads are running
Locks, atomics, and run-once Mutex · Atomic variable · Run-once initialization Keeping every update · run-once: chapter 04, planned RwLock and atomics ↗ · Lock poisoning ↗ · Forgotten unlock ↗ Atomic counters ↗ · sync.Once runs exactly once ↗ · A WaitGroup counts goroutines ↗
The lost update in a database Compare-and-swap · MVCC The lost update in a database
When order changes a sum: floats, refusals, duplicates Idempotency When does order change a sum? What a float actually stores ↗ · Letting the compiler reorder a float sum ↗ Math: Catastrophic cancellation ↗
Splitting work across cores Data parallelism · Map-reduce Splitting a sum across workers Letting the compiler reorder a float sum ↗ Fan-out, fan-in ↗
Deadlock Deadlock · Leaked tasks chapter 03, planned All goroutines are asleep ↗ · A leaked goroutine never ends ↗
Cancellation and deadlines Cancellation · Structured concurrency chapter 06, planned One cancel reaches every goroutine ↗ · A deadline is a cancel with a clock ↗ · Cancel with a cause ↗
Patterns Pipeline · Fan-out, fan-in · Worker pool · Semaphore chapter 05, planned A pipeline of stages ↗ · Fan-out, fan-in ↗ · A worker pool ↗ · A buffered channel as a semaphore ↗ · The first error cancels the rest ↗
Async Async and await · Future and promise · Event loop chapter 06, planned Instrumenting async code ↗
Testing concurrent code Deterministic scheduling for tests · Heisenbug chapter 09, planned synctest makes time virtual ↗ · synctest.Wait instead of a sleep ↗
Concurrent processes Process · Inter-process communication chapter 08, planned Linux: head closes the pipe early ↗ · A pipeline reports its last command ↗ · Two terminals, one history file ↗