• Python Snacks
  • Posts
  • Why Python 3.14 GIL Update is Significant for Threading

Why Python 3.14 GIL Update is Significant for Threading

The GIL isn't a bottleneck anymore - threading is truly going threaded.

One of Python’s largest bottlenecks is due to the limitations of the GIL, or the Global Lock Interpreter.

The GIL is a mutex that ensures only one thread can execute Python code at a time, even on multi-core machines. This made memory management simpler, but it crippled Python’s ability to run CPU-bound code in parallel.

The problem: threading wasn’t… actually threading

You could start 10 threads in a Python program and it gives us the illusion that there is concurrency. But due to the GIL, only one of them ran at a time for CPU-bound tasks, such as the benchmark below.

» I/O tasks such as downloading files, reading from disk, and making API calls aren’t as bottlenecked because Python releases the GIL while waiting on I/O.

Because of the GIL, only one thread can execute Python bytecode at a time, and Python has to constantly switch between them, known better as context switching. Context switching adds overhead and slows things down further for CPU-bound programs.

At the end of the day, your threads are still in one process which runs on one single CPU. So if the process crashes, all of your threads die.

Pre-3.14 solution: multiprocessing

The current (as of this writing, 3.13) Python version to get around this was through multiprocessing, which lets you run multiple processes across all of your CPU cores instead of on a single one.

To give additional context to the topic, a diagram to show the differences between threading and multiprocessing is below - you can imagine that each green squiggly line does something (let’s say increment a number 1B times):

Threading vs Multiprocessing

Each task we want to run runs on a separate CPU core, which means that each process (black box) has its own GIL, allowing for true parallelism.

Python 3.14’s threading update

Given all this context, PEP 779 is getting implemented to allow for true parallelism using threads. CPython in Python 3.14 officially supports free-threaded build, which removes the GIL all together, which marks a major milestone in Python’s concurrency journey.

With this new update, all of your threads will still run inside of a single process (black box shown above), but now they’ll be spread across multiple CPU cores, running in parallel using the same Python interpreter.

Benchmarking the update

Suppose we have the following code:

import threading
import time
import sys

print(f"Python version: {sys.version}")

def count():
    count = 0
    for _ in range(10**9):
        count += 1

start = time.time()

t1 = threading.Thread(target=count)
t2 = threading.Thread(target=count)

t1.start()
t2.start()

t1.join()
t2.join()

end = time.time()
print(f"CPU-bound threaded time: {end - start:.2f} seconds")

I installed Python 3.14 onto my machine, created a virtual environment, and ran this code with both Python 3.12 and 3.14 and benchmarked it, where we found the code to run ~27% quicker due to the threading update:

(py312) mac:~ $ python threading_test.py 
Python version: 3.12.2 (v3.12.2:6abddd9f6a, Feb  6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)]
CPU-bound threaded time: 37.35 seconds
(py314) mac:~ bmolyneaux$ python threading_test.py 
Python version: 3.14.0b4 (main, Jul 21 2025, 19:14:12) [Clang 15.0.0 (clang-1500.1.0.2.5)]
CPU-bound threaded time: 27.21 seconds

Happy coding!

📧 Join the Python Snacks Newsletter! 🐍

Want even more Python-related content that’s useful? Here’s 3 reasons why you should subscribe the Python Snacks newsletter:

  1. Get Ahead in Python with bite-sized Python tips and tricks delivered straight to your inbox, like the one above.

  2. Exclusive Subscriber Perks: Receive a curated selection of up to 6 high-impact Python resources, tips, and exclusive insights with each email.

  3. Get Smarter with Python in under 5 minutes. Your next Python breakthrough could just an email away.

You can unsubscribe at any time.

Interested in starting a newsletter or a blog?

Do you have a wealth of knowledge and insights to share with the world? Starting your own newsletter or blog is an excellent way to establish yourself as an authority in your field, connect with a like-minded community, and open up new opportunities.

If TikTok, Twitter, Facebook, or other social media platforms were to get banned, you’d lose all your followers. This is why you should start a newsletter: you own your audience.

This article may contain affiliate links. Affiliate links come at no cost to you and support the costs of this blog. Should you purchase a product/service from an affiliate link, it will come at no additional cost to you.

Reply

or to participate.