LESSON 1.10 · 6 STAGES · 4 CONTROLS · 3 CHECKSPRO · PREVIEW
Multiprocessing
Watch a pool split 8 tasks across processes that share no memory.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 4 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 1.10 · PROCESS BAY3 PROCESSES · 2 WORKERS · FORK · 10 MS
01
Stage 1 of 6 · Start workers
Pool(2) starts 2 worker processes in 10 ms. fork gives each one a copy of the parent's memory.
Explain it simply
A process is a running program with its own memory. Pool(2) starts 2 worker processes beside the parent. With fork, each worker starts as a copy of the parent's memory: count, task, TASKS and data. After that, the copies are separate, so a change in one never reaches another.
The parent process, pid 4110, holds count, task, TASKS, data and pool. 2 worker processes start in 10 ms. Each worker holds count, task, TASKS, data.
process memorytask data, Python workI/O waitworker start, data copyresultpickling error
Toy: 1.C1's 8 tasks · 10 ms worker start · copies at 100 MB/s · real pickle bytes (protocol 4) · pids are stand-ins
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
The pool adds w worker processes, each with its own memory.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 4 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.