topic: concurrency
rust's ownership model makes data-race-free concurrency a compile-time guarantee.
rayon adds effortless parallelism via par_iter().
concepts to demonstrate
std::thread::spawn + join
- channels:
mpsc::channel for inter-thread communication
Arc<Mutex<T>> for shared mutable state
- rayon
par_iter() for parallel data processing
patriots theme
parallel stat aggregation across all 2004 regular season games.
spawn a thread per week, compute weekly box scores, send results back via channel.
then rayon version: games.par_iter().map(compute_box_score).collect().
file
src/concurrency/parallel_stats.rs
note
rust-only concept. no python mirror. show how this compares to python's GIL limitations.
topic: concurrency
rust's ownership model makes data-race-free concurrency a compile-time guarantee.
rayon adds effortless parallelism via par_iter().
concepts to demonstrate
std::thread::spawn+joinmpsc::channelfor inter-thread communicationArc<Mutex<T>>for shared mutable statepar_iter()for parallel data processingpatriots theme
parallel stat aggregation across all 2004 regular season games.
spawn a thread per week, compute weekly box scores, send results back via channel.
then rayon version:
games.par_iter().map(compute_box_score).collect().file
src/concurrency/parallel_stats.rsnote
rust-only concept. no python mirror. show how this compares to python's GIL limitations.