liveBook · Manning

Decomposition

As explained in Learn Concurrent Programming with Go

Task decomposition is the technique of dividing a computation into distinct units of work that can be assigned or coordinated independently.

Decomposition divides a program into distinct tasks and identifies which tasks can run concurrently. The key test is whether computations are sufficiently independent to execute together. section 10.0 section 10.1

Use task decomposition to turn a concurrent design into an explicit dependency and coordination problem:

  • List the actions needed to complete the job. section 10.1
  • Draw dependencies between actions; independent actions can proceed in parallel, while dependent actions must wait. section 10.1 section 10.1.1
  • Choose granularity deliberately: fine-grained tasks increase parallelism but communication and synchronization, while coarse-grained tasks reduce coordination overhead. section 10.4
  • Compare task decomposition with data decomposition, which partitions data so separate tasks can process it concurrently. section 10.4

Changing a flat tire

Applying the handbrake, unloading the spare, loosening nuts, jacking the car, replacing the tire, and stowing the old tire creates a dependency structure. Unloading the spare can overlap with loosening the nuts, while stowing the old tire waits until removal. section 10.1

Finding the longest words

Downloading web pages, extracting words, and finding the longest words form separate tasks, but each depends on the preceding task. The breakdown exposes where parallel execution is possible and where ordering is required. section 10.1.1

Figure 10.1 Task dependency graph for changing a flat tire

Use the task dependency graph to inspect which tire-changing actions can be assigned concurrently. section 10.1

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains task lists, dependency graphs, task-versus-data decomposition, and granularity trade-offs, then defers implementation patterns.
Examples
Uses a flat-tire repair workflow and web-page word processing to illustrate parallel actions and sequential dependencies.
What it assumes
Assumes a program or job to analyze and teaches decomposition through everyday procedures before applying it to concurrent programs.
What you can do after
Apply task decomposition by listing work, mapping dependencies, and identifying actions suitable for concurrent execution.
How it connects
Connects task decomposition with data decomposition, dependency graphs, loop-level parallelism, fork/join, worker pools, and pipelines.

Also explained in

Compare how 10 books explain decomposition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Concurrent Programming with Go. The section links point to the parts of the book it draws on.