Threads vs processes & the GIL
P32.threads-processes.01 · Audience: Guest, IT/ML learner, Language professional
Where next?
Later in Threads & Processes
This module unlocks
P32.threads-processes.01 · Audience: Guest, IT/ML learner, Language professional
Later in Threads & Processes
This module unlocks
"Just add threads" is the most common way to not speed up a CPU-bound Python program. This module explains why — the Global Interpreter Lock — and then makes the difference between threads and processes concrete by looking at process IDs.
Why it matters — If you believe threads run Python in parallel, every CPU-bound 'optimisation' you write with them will disappoint you — and you won't know why.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
First argue the choice in an interview-style prompt, then prove the thread/process distinction with real process IDs (kernel runtime).
Loading exercise…
Loading exercise…
Once you can say why a CPU-bound loop needs processes and an I/O-bound one is
happy with threads, the rest of concurrency is mechanics — which the next module
turns into concurrent.futures.
Loading your notes...