Demystifying the GIL
summary
Python 3.14 exposes a Python 3.14 GIL‑free interpreter that makes prior accidental thread safety visible: a shared counter example runs wrong without synchronization because counter += 1 breaks into multiple opcodes, and adding a mutex fixes correctness but induces heavy contention and cache thrashing. Reproducible examples live in the repo and run via a thread pool executor and makefile targets (e.g. make FT friendly); embarrassingly parallel work shows about a ~7× speedup, while baseline overhead of GIL removal averages ~16%.
AI-written summary · about
chapters (19)
- 0:00GIL introduction
- 1:12GIL origins surprise
- 2:39GIL removal myths
- 3:01Demo: Shared counter
- 5:29Counter fails without GIL
- 7:55Locks and mutexes
- 9:41Locks performance impact
- 11:06Concurrency harder than it seems
- 12:34Free threading works here
- 14:43Async IO and offloading
- 16:09GIL removal overhead
- 17:34GIL history
- 24:21Failed GIL removal attempts
- 26:30Free threading today
- 27:34Use concurrency in Python?
- 28:58Even if your code works, libraries might not
- 29:18Q&A: GIL trade-offs
- 33:31Q&A: Free threading vs multiprocessing
- 37:07Closing thoughts
related talks
29mPython's Infamous GIL
43mGIL: What's the hassle and... should I care?
32mGIL - What it is and how to fight it
29mGoodbye GIL: Exploring the Free-threaded mode in Python
28mGIL: Everything You Wanted to Know and Were Afraid to Ask
29mTrying No GIL on Scientific Programming
31mGetting Around the GIL: Parallelizing Python for Better Performance
28mThe GIL is dead: PyPy-STM
