liveBook · Manning

Locality

As explained in Grokking Concurrency

Locality is the property of placing interacting tasks or accessed data close together in a computational or memory hierarchy to reduce access and communication costs.

Locality means keeping tasks that interact close together so they communicate less and spend less time waiting. Combining communicating tasks can make their data exchange part of one task, removing that communication overhead. section 13.6

Two ways to reduce communication overhead are:

  • Combine tasks that exchange data, so their communication happens within one task. section 13.6
  • Group tasks that send data and tasks that receive it. This can reduce total waiting time, though it does not shorten transmission time. section 13.6

Mapping matrix multiplication

A fine-grained approach assigns one task to each result-matrix element. Mapping can favor placing parallel tasks on different processors or keeping interacting tasks together; these goals can conflict. In a desktop example, the operating system handles task mapping and scheduling. section 13.6 section 13.7

How Grokking Concurrency covers it

How deep it goes
Defines locality and explains task merging and grouping, but leaves mapping-algorithm design beyond scope.
Examples
Uses matrix multiplication to illustrate fine-grained tasks and processor-placement tradeoffs.
What you can do after
Evaluate task groupings and processor placements by weighing communication savings against concurrency and resource use.
How it connects
Connects locality with task mapping, parallelism, communication overhead, and waiting time.

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.