Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Parallel Programming in Modern Python
New
Rating: 5.0 out of 5(2 ratings)
2 students

Parallel Programming in Modern Python

Threads, the GIL, free-threaded Python, processes and subinterpreters: how Python really runs many things at once
Last updated 11/2026
English

What you'll learn

  • Explain what happens in memory when Python creates, shares and destroys an object, from reference counts to the garbage collector
  • Measure when threads speed up a program and when the GIL holds them back, on the standard and the free-threaded build
  • Create race conditions on purpose, fix them with locks, queues and executors, and recognize a deadlock
  • Run Python code in parallel with processes and pools, and measure the real price of starting them and of moving data between them
  • Share large arrays between processes without copying them, with shared memory
  • Run several interpreters inside one process with concurrent.interpreters and the InterpreterPoolExecutor
  • Choose between threads, processes and interpreters for a real workload, by measuring instead of guessing

Coding Exercises

This course includes our updated coding exercises so you can practice your skills as you learn.

See a demo
Image of coding exercise example

Course content

8 sections • 53 lectures • 3h 22m total length
  • Introduction to the Course3:37

Requirements

  • The basics of Python: functions, classes and modules
  • No experience with threads or processes: everything is built from zero
  • A computer where you can install Python. We set up both builds together in Chapter 0

Description

This course contains the use of artificial intelligence. The curriculum, the code, the experiments, and the explanations were designed, reviewed, and verified by the instructor, and every result on screen comes from code run on a real machine.

Our computer has many cores, but a typical Python program uses only one. This course is about putting the others to work and understanding what really happens when Python does many things at once.

The course starts from a single object in memory all the way to every core of the machine:

  • Memory management. What an object really is and what it costs in bytes, how Python counts the references to it, the exact moment it dies, immortal objects, reference cycles and the garbage collector, weak references, slots and tracemalloc.

  • Threads and the GIL. Threads that wait and threads that compute, the Global Interpreter Lock at work on a timeline of who ran when, race conditions created on purpose, locks and deadlocks, queues, and the ThreadPoolExecutor.

  • Free-threaded Python. The same experiments without the GIL: what gets faster, what the built-in types still guarantee, how Python protects its reference counts without the lock, and when the GIL comes back.

  • Multiprocessing. Processes and the ways to start them, the __main__ guard, pools and the ProcessPoolExecutor, the real price of a process and of pickling, queues, shared arrays, shared memory and managers.

  • Subinterpreters, and how to choose. Several interpreters inside one process with interpreters and the InterpreterPoolExecutor, their current limits, and finally every tool side by side on the same workload, with a decision guide to take with you.

Every claim in this course is measured in a notebook, and all the code is yours to run on your own machine. Your numbers will differ from the ones on screen, because every machine is different, but the shape of the results will not.

The course mixes three kinds of lecture: slides that open and close each chapter, notebooks where the code is written and run step by step, and animations that show what happens inside the machine, where no notebook can reach.

Everything is recorded on Python 3.15, with the standard and the free-threaded build installed side by side. Whenever something depends on the version, the course says so out loud.

Who this course is for:

  • Python programmers who want to know what really happens underneath when code runs at the same time
  • Programmers whose threads behave strangely, and who want to understand why
  • Scientists and engineers whose heavy computations leave most of the machine idle
  • Developers who use AI assistants to write concurrent code, and want to spot the race conditions hidden in it
  • Anyone curious about free-threaded Python and subinterpreters, the biggest changes to Python in many years