The parallelize Function
Run loop iterations across threads.
One Core Is Not Enough
A plain loop runs on a single core while the rest sit idle. For heavy work, that wastes most of your CPU.
for i in range(n):
out[i] = heavy(i)Spread the Work
Parallelism means handing different loop iterations to different cores so they all work at the same time. 🧵
All lessons in this course
- The parallelize Function
- Splitting Work into Chunks
- Combining Parallel and Vector
- Avoiding Data Races