liveBook · Manning

Loop-carried dependence

As explained in Learn Concurrent Programming with Go

A loop-carried dependence occurs when a step in one loop iteration depends on a step from another iteration of the same loop.

A loop-carried dependence occurs when a step in one iteration depends on a step from another iteration of the same loop. Iteration i cannot complete its aggregation until iteration i−1 has finished. section 10.2.1

Directory hashing makes the constraint concrete: each file hash can be computed independently, but the hashes must be added to sha256 in loop order. Reordering them produces a different directory hash. section 10.2.1

How Learn Concurrent Programming with Go covers it

How deep it goes
Defines the dependence and works through directory hashing with goroutines and chained channels.
Examples
Uses per-file hashing and whole-directory hashing to contrast independent iterations with dependent aggregation.
What it assumes
Assumes basic loops and file hashing, while introducing the dependence constraint through a concrete Go program.
What you can do after
Apply it via Go by parallelizing independent computation while synchronizing the order-dependent step.
How it connects
Connects loop-level parallelism with goroutines, channels, SHA-256 hashing, and ordered aggregation.

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.