Skip to main content
Loading page…
Python Mastery
Chapter 36
Lesson 2 of 3
Threading, the GIL & Free-threaded Python
Contents
Notes
Tutor
Concept
Threads: Shared Memory, Multiple Flows
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
25 min
9 activities
0 of 9 done
In this lesson
1
Threads: Shared Memory, Multiple Flows
2
The Global Interpreter Lock (GIL)
3
ThreadPoolExecutor: The Practical Way to Use Threads
4
Race Conditions and Locks
5
Check: The GIL and CPU-bound threads
6
Thread-safe Counter with Lock
7
Practice: Fix the Race Condition
8
Pitfall: Deadlock
9
Threading Knowledge Check
Objectives
Spawn and join threads using threading.Thread and ThreadPoolExecutor
Explain what the GIL is and why it limits CPU-bound threading
Identify and fix a race condition using threading.Lock
Choose between threads and asyncio for IO-bound work
Further reading
threading - Thread-based parallelism
Python 3.14 free-threaded mode improvements
Chapter 36 · Concurrency & Parallelism
async / await, asyncio & Structured Concurrency
Threading, the GIL & Free-threaded Python
Multiprocessing for CPU Work
Previous: async / await, asyncio & Structured Concurrency
Next: Multiprocessing for CPU Work