Understanding the Python GIL
Channel:David Beazley · Length:46:09 · Published:2012-02-03 · Views:127808
Summary
David Beazley's PyCon 2010 talk explains how the Python Global Interpreter Lock works and shows experiments where multithreaded code runs slower, even on more cores, due to lock contention and context-switching overhead.
Why HN recommends it
The canonical recommendation for understanding the GIL, praised both for its clarity and for how well it explains a deep technical topic.
My favorite example is Beazley's GIL talk — HN, 2014
Python, Ruby & scripting languages · Software performance & optimization
Subtitles (excerpt)
um hopefully everybody's ready for the enormous Gill talk uh here so I'm Dave um we're going to do in this talk uh so I I'm I'm assuming that a few of you know that python Has This Global interpreter lock a couple people have heard of that um I I think there should be like a a module corresponding to the import this this is the import that you know the things that you're not supposed to talk about you know and a gill could be on that on that list so um big thing with the Gill people know that limits thread performance and because of that it's this source of of some you occasionally see contention on like news groups and blogs and things about it um and so in this talk we're going to we're going to talk about it um to introduce the talk I wanted to show a demo first just to to set up why I'm interested in it um what I'm going to uh start with is just this is just a a dumb program that just spins for a bunch of calculations in a single thread basically so this is a a little countdown uh program that does 50 million iterations of some some task uh sequentially and I just time it and and see what happens um if you run that um takes about took about 5 Seconds when I tested this out this morning okay so 5.4 seconds um and what
On Hacker News
"The point of such a presentation is to take a piece of code that the presenter has understood deeply and for them to help the audience understand the core ideas..." I do get lots of value out of that. My favorite example is Beazley's GIL talk: [VIDEO] — famousactress, 2014-01
I am not expert, and this might be dated information, but historically there is a "thrashing" introduced between the GIL and OS scheduled threads which has surprising performance implications. David Beazley does a much better illustrating the nuances than I ever could: [VIDEO] Including a wild phenomenon where a threaded Python program's performance can degrade by increasing number of CPU cores a… — gshulegaard, 2022-08
David probably isnt the best guy for that. But here's one of the famous ones on GIL. [VIDEO] Beware though, his talks are known to be devastating to the programmer, resulting in serious head injuries, trauma, headaches and other fun stuff. — devxpy, 2018-07
"I never actually got around to learning -- or even thinking about!-- what exactly the GIL is" David Beazley does a good job on explaining the GIL. There are multiple videos of his GIL talks on YouTube. This one, for instance: [VIDEO] He has a page about this at [LINK] — Luyt, 2013-06
There's a GIL presentation [1] from 2010 which shows Python 3.2 on a 1 CPU machine was faster than on a dual core. In all, there might be reason to expect GILless python to be faster single core in certain scenario's. [1] [VIDEO] — rvanlaar, 2023-10
Related videos
- Larry Hastings - Removing Python's GIL: The Gilectomy - PyCon 2016 · PyCon 2016 · 32:07
- What the heck is the event loop anyway? | Philip Roberts | JSConf EU · JSConf · 26:52
- Build Your Own Async · David Beazley · 2:12:41
- Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich · Confreaks · 53:21
- The spelled-out intro to neural networks and backpropagation: building micrograd · Andrej Karpathy · 2:25:52
- How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework · Видео с мероприятий {speach! · 49:55
- RailsConf 2014 - All the Little Things by Sandi Metz · Confreaks · 38:47
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- How To Design A Good API and Why it Matters · Google TechTalks · 1:00:19
- The Problem with Time & Timezones - Computerphile · Computerphile · 10:12
- Preventing the Collapse of Civilization / Jonathan Blow (Thekla, Inc) · DevGAMM · 1:02:41
- "Performance Matters" by Emery Berger · Strange Loop Conference · 42:15
- RailsConf 2016 - Turbolinks 5: I Can’t Believe It’s Not Native! by Sam Stephenson · Confreaks · 37:37
- The Thirty Million Line Problem · Molly Rocket · 1:48:55
- CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step” · CppCon · 59:33
- Brian Goetz - Stewardship: the Sobering Parts · ClojureTV · 1:03:30