<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag" -->

---
title: Demystifying the GIL - Bruce Eckel | daily.dev
description: Bruce Eckel's PyCon talk walks through what changes when Python's Global Interpreter Lock (GIL) is removed via free-threaded Python. Using live demos, he shows...
canonical: https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Demystifying the GIL - Bruce Eckel | daily.dev
og:description: Bruce Eckel's PyCon talk walks through what changes when Python's Global Interpreter Lock (GIL) is removed via free-threaded Python. Using live demos, he shows...
og:url: https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag
og:image: https://api.daily.dev/og/posts/aOhjxvnAg.png
og:image:alt: Demystifying the GIL - Bruce Eckel
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Demystifying the GIL - Bruce Eckel

**[PyCon US](https://daily.dev/sources/pyconus)** · 37 min read · 0 upvotes · 0 comments

## Summary

Bruce Eckel's PyCon talk walks through what changes when Python's Global Interpreter Lock (GIL) is removed via free-threaded Python. Using live demos, he shows how removing the GIL exposes race conditions in seemingly simple code (like counter += 1, which compiles to four opcodes), why free threading isn't a universal speedup (contention and cache misses can make things slower), and where it genuinely helps (embarrassingly parallel work, offloading blocking calls from async event loops). He covers the historical reasons the GIL exists (reference counting, the C extension ABI), other concurrency strategies (multiprocessing, sub-interpreters, async io), and closes with pragmatic advice: avoid concurrency if you can, try faster hardware or profiling first, and use AI tools to experiment with rewriting hot paths in Rust via PyO3 or migrating between concurrency models.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=MC1PQ7ZgUeU>

## Questions this post answers

### Why does counter += 1 produce wrong results in Python's free-threaded (no-GIL) build but work fine with the GIL?

Counter += 1 compiles to four separate Python opcodes (load, push, add, store), and without the GIL, multiple threads running on separate cores can interleave those opcodes, so a thread's write can overwrite another thread's increment. Before Python 3.11 context switches could occur between any opcodes; after 3.11 that specific operation became atomic only under the GIL, but with free threading true parallel execution reintroduces the race, requiring an explicit lock to serialize access.

_Developers weighing a move to free-threaded Python track gotchas like this one on daily.dev before they hit production._

### Does switching from multiprocessing to Python's free-threaded build always make code faster?

No, it depends heavily on the workload. Embarrassingly parallel calculations with no shared state saw close to a sevenfold speedup under free threading, but code with shared mutable state and lock contention actually ran slower than the GIL version due to CPU cache invalidation and contention overhead. Free threading also adds roughly 16% overhead to regular single-threaded code compared to the GIL version, even when no threads are used.

_Anyone deciding whether to migrate multiprocessing code to free threading can weigh trade-offs like these through daily.dev._

### What made Python adopt the Global Interpreter Lock in the first place?

Python originally used simple reference counting for garbage collection, and once C extensions were allowed to manipulate Python objects directly, that reference-counting layout became locked into the application binary interface and couldn't be changed. When Python later needed OS threads for context switching (handling keyboard input, IO, etc.), those threads could race on reference count updates, so a single interpreter-wide lock was introduced to protect them, incidentally giving accidental thread safety to single-threaded code.

_Developers curious about Python's concurrency history can follow how the free-threading transition unfolds on daily.dev._

## Similar posts on daily.dev

- [Understanding Python’s Global Interpreter Lock \(GIL\): Explained Simply](https://daily.dev/posts/understanding-python-s-global-interpreter-lock-gil-explained-simply-zsdzigje6) · Medium · 0 upvotes · 0 comments
- [What is \(was?\) GIL in Python?](https://daily.dev/posts/what-is-was-gil-in-python--nycowwdtu) · Daily Dose of Data Science \| Avi Chawla \| Substack · 2 upvotes · 0 comments
- [\[2603.04782\] Unlocking Python's Cores: Hardware Usage and Energy Implications of Removing the GIL](https://daily.dev/posts/2603-04782-unlocking-python-s-cores-hardware-usage-and-energy-implications-of-removing-the-gil-twbo12tky) · Hacker News · 2 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Demystifying the GIL - Bruce Eckel","url":"https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag"},"datePublished":"2026-08-25T18:58:22.395Z","dateModified":"2026-08-25T18:58:55.441Z","description":"Bruce Eckel's PyCon talk walks through what changes when Python's Global Interpreter Lock (GIL) is removed via free-threaded Python. Using live demos, he shows...","image":"https://i.ytimg.com/vi/MC1PQ7ZgUeU/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/MC1PQ7ZgUeU/sddefault.jpg","isAccessibleForFree":true,"articleSection":"PyCon US","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"PyCon US","logo":"https://media.daily.dev/image/upload/s--DLedNxG1--/f_auto,q_auto/v1777800767/logos/pyconus?_a=BAMAMiWQ0","url":"https://daily.dev/sources/pyconus"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python","timeRequired":"PT37M","video":{"@type":"VideoObject","name":"Demystifying the GIL - Bruce Eckel","description":"Bruce Eckel's PyCon talk walks through what changes when Python's Global Interpreter Lock (GIL) is removed via free-threaded Python. Using live demos, he shows...","thumbnailUrl":"https://i.ytimg.com/vi/MC1PQ7ZgUeU/sddefault.jpg","uploadDate":"2026-08-25T18:58:22.395Z","duration":"PT37M","url":"https://api.daily.dev/r/aOhjxvnAg","embedUrl":"https://www.youtube.com/embed/MC1PQ7ZgUeU"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PyCon US","item":"https://daily.dev/sources/pyconus"},{"@type":"ListItem","position":3,"name":"Demystifying the GIL - Bruce Eckel"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/demystifying-the-gil---bruce-eckel-aohjxvnag#faq","mainEntity":[{"@type":"Question","name":"Why does counter += 1 produce wrong results in Python's free-threaded (no-GIL) build but work fine with the GIL?","acceptedAnswer":{"@type":"Answer","text":"Counter += 1 compiles to four separate Python opcodes (load, push, add, store), and without the GIL, multiple threads running on separate cores can interleave those opcodes, so a thread's write can overwrite another thread's increment. Before Python 3.11 context switches could occur between any opcodes; after 3.11 that specific operation became atomic only under the GIL, but with free threading true parallel execution reintroduces the race, requiring an explicit lock to serialize access. Developers weighing a move to free-threaded Python track gotchas like this one on daily.dev before they hit production."}},{"@type":"Question","name":"Does switching from multiprocessing to Python's free-threaded build always make code faster?","acceptedAnswer":{"@type":"Answer","text":"No, it depends heavily on the workload. Embarrassingly parallel calculations with no shared state saw close to a sevenfold speedup under free threading, but code with shared mutable state and lock contention actually ran slower than the GIL version due to CPU cache invalidation and contention overhead. Free threading also adds roughly 16% overhead to regular single-threaded code compared to the GIL version, even when no threads are used. Anyone deciding whether to migrate multiprocessing code to free threading can weigh trade-offs like these through daily.dev."}},{"@type":"Question","name":"What made Python adopt the Global Interpreter Lock in the first place?","acceptedAnswer":{"@type":"Answer","text":"Python originally used simple reference counting for garbage collection, and once C extensions were allowed to manipulate Python objects directly, that reference-counting layout became locked into the application binary interface and couldn't be changed. When Python later needed OS threads for context switching (handling keyboard input, IO, etc.), those threads could race on reference count updates, so a single interpreter-wide lock was introduced to protect them, incidentally giving accidental thread safety to single-threaded code. Developers curious about Python's concurrency history can follow how the free-threading transition unfolds on daily.dev."}}]}
```

