0Pricing
Mojo Academy · Lesson

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

  1. The parallelize Function
  2. Splitting Work into Chunks
  3. Combining Parallel and Vector
  4. Avoiding Data Races
← Back to Mojo Academy