Granularity describes how a computation is divided into tasks: both the number of tasks and the amount of work in each task. A decomposition with larger tasks is coarse-grained; one with many smaller tasks is fine-grained. section 7.9
Choosing granularity is part of decomposing a concurrent application. The goal is to expose enough independent work for available processing resources without creating unnecessary communication or coordination. section 7.0 section 7.9
The main trade-offs are:
- Coarse-grained decomposition assigns larger computations to fewer tasks. It reduces communication and coordination overhead, but uneven task sizes can leave processors idle and limit concurrency. section 7.9
- Fine-grained decomposition creates many smaller tasks. It exposes more parallelism and gives the runtime more flexibility in scheduling work across available resources. section 7.9
- A useful target is at least as many tasks as available processing resources, preferably more, so the runtime can keep resources busy and schedule work flexibly. section 7.10
Four versus eight threads
On a system with eight cores, dividing work into four threads leaves four cores idle under the stated assumptions. Dividing it into eight threads creates a finer-grained decomposition: all eight tasks can run together when eight cores are available. With only four available cores, the scheduler can run four threads first and the remaining four afterward. section 7.9







