liveBook · Manning

Concurrency model

As explained in Go in Action, Second Edition

A concurrency model is the set of language abstractions and rules governing the execution and coordination of multiple computations.

A concurrency model defines how multiple computations execute and coordinate. Go makes concurrency a language-level concern rather than an optional library or configurable framework. Its design follows communicating sequential processes: independent processes communicate by passing messages instead of sharing memory. section 1.4

Concurrency manages progress across multiple tasks, while parallelism performs tasks simultaneously, typically on separate processors or cores. Go supplies goroutines and channels, while the runtime handles scheduling and execution. section 9.0

A practical Go concurrency design combines:

  • Goroutines for running functions concurrently without directly managing threads. section 9.7
  • Channels for safe communication, including pipelines, worker pools, and fan-in/fan-out patterns. section 9.7
  • WaitGroup, mutex, errgroup, and context.Context for synchronization, shared-data protection, error handling, cancellation, timeouts, and request-scoped values. section 9.7
  • select, buffered channels, and directional channels for responsive event loops and controlled data flow. section 9.7

Independent chores

Baking a chicken, doing laundry, and sending an email illustrate concurrent progress: the oven and washing machine can operate while the email is sent. In Go, independent work can run in goroutines and coordinate through channels rather than requiring direct thread management. section 9.0

Use concurrency for independent, especially I/O-bound, network, or parallelizable work. Avoid it for simple, strictly ordered, or single-task programs; always handle errors and channel closure to prevent leaks and silent failures. section 9.7

How Go in Action, Second Edition covers it

How deep it goes
Explains CSP roots, goroutines, channels, synchronization, cancellation, patterns, and design cautions without descending into scheduler internals.
Examples
Uses simultaneous chores, goroutines, channels, worker pools, pipelines, fan-in/fan-out, and select-based event loops.
What it assumes
Assumes general programming ability while teaching concurrency, parallelism, goroutines, channels, and coordination mechanisms.
What you can do after
Apply it via goroutines, channels, synchronization tools, and context.Context to build and control concurrent workloads.
How it connects
Connects goroutines, channels, parallelism, mutexes, context cancellation, worker pools, pipelines, and fan-in/fan-out.

Also explained in

Compare how 2 books explain concurrency model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Action, Second Edition. The section links point to the parts of the book it draws on.