baby steps
rustdata-parallelismfork-jointype-systemconcurrency
Abstraction: Fork-join data parallelism in Rust via type-system-enforced data-race freedom
Key points:
- Proposes lightweight "jobs" distinct from Rust tasks: jobs share parent stack memory and have fixed fork-join lifetimes
- Two primitives:
parallel::execute(closures)runs N closures in parallel;parallel::divide(slice, closure)splits a mutable slice across parallel workers - Existing borrow checker rules (&mut T aliasing prohibition) naturally prevent most data races at compile time without runtime overhead
- Closure bounds
fn:Isolate()andfn:Share()further restrict what values closures may capture: Isolate allows &mut T (exclusive), Share excludes &mut (multiple concurrent readers) - Hierarchy: Isolate ⊃ Share ⊃ {Freeze, Send} — new bounds fit above existing built-in bounds
- Follows "three layer cake" model: message-passing actors → fork-join jobs → SIMD primitives; implementable as a library with no runtime changes
Connections: Rust Language · Data Parallelism · Type System · Concurrency
Source: http://smallcultfollowing.com/babysteps/blog/2013/06/11/data-parallelism-in-rust/