liveBook · Manning

Coarse-grained decomposition

As explained in Grokking Concurrency

Coarse-grained decomposition divides a computation into relatively few large tasks.

Imagine dividing a large delivery route among a few drivers, giving each one a substantial region. Coarse-grained decomposition splits a computation into relatively few, large tasks. Each processor handles considerable work, reducing the communication and coordination needed between tasks. section 7.9

Four or eight workers

Splitting work into eight threads instead of four creates finer-grained tasks that can use more available cores. With coarse-grained tasks, fewer workers perform larger portions of the computation. This can leave some processors idle when tasks contain unequal amounts of data, but it avoids the heavier communication and task-creation costs of millions of tiny tasks. section 7.9

The useful choice lies between the extremes. Coarse tasks limit coordination overhead but risk load imbalance; fine tasks improve distribution and parallelism but increase communication, creation, and scheduling costs. section 7.9

How Grokking Concurrency covers it

How deep it goes
Explains task size, processor utilization, load imbalance, communication, and scheduling costs without detailing implementation procedures.
Examples
Uses four-versus-eight threads, four-versus-eight cores, and a million-task scheduling scenario to contrast granularity choices.
What you can do after
Evaluate granularity choices by weighing load balance and parallelism against communication, task-creation, and scheduling overhead.
How it connects
Connects task decomposition with fine-grained decomposition, parallelism, load imbalance, communication overhead, and task scheduling.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Concurrency. The section links point to the parts of the book it draws on.