CPython Free Threading and Concurrency
Free threading changes where Python code can execute in parallel. Locks, executors, asynchronous tasks, and experimental concurrency models address different concerns above that runtime capability.
Related: CPython, the JVM, and polymorphism · Python data model and native extensions.
Free-threaded execution
Free-threaded CPython allows Python threads to execute on multiple CPU cores within one interpreter. It became an experimental build option in Python 3.13 and an officially supported, still optional build in Python 3.14. 1
A free-threaded build and a disabled GIL are separate conditions: these builds can run with the GIL enabled, and an incompatible C extension can re-enable it. The normal GIL-enabled build remains a distinct configuration.
Execution models
A GIL-enabled interpreter can have multiple operating-system threads, but generally permits only one of them at a time to execute Python bytecode.
For a single interpreter:
One nuance: even traditional CPython could achieve parallel execution when native extensions released the GIL, as NumPy often does.
Interpreter changes
The GIL historically protected internal interpreter state, including object reference counts and operations involving Python objects.
Removing it required changes throughout CPython, including:
- Biased and deferred reference counting: reduce contention when multiple threads access objects.
- Fine-grained locking: containers such as lists and dictionaries have internal synchronization.
- Thread-safe memory management: changes to memory allocation and object lifetime handling.
- Updated C extension interfaces: native modules must explicitly support free threading.
With the GIL disabled, more specific synchronization mechanisms protect interpreter internals. 2, 3
CPU-bound work with a thread pool
Consider a CPU-intensive workload using ThreadPoolExecutor:
from concurrent.futures import ThreadPoolExecutor
def compute(n):
return sum(i * i for i in range(n))
with ThreadPoolExecutor(max_workers=4) as pool:
results = list(pool.map(compute, [10_000_000] * 4))With the GIL enabled, these pure-Python tasks compete for execution time. With the GIL disabled in a free-threaded build, they can run on separate cores when the machine has sufficient CPU capacity.
That doesn’t guarantee a 4× speedup. Thread scheduling, memory contention, and synchronization introduce overhead.
Choosing an execution mechanism
asyncioremains useful for managing concurrent I/O.multiprocessingremains useful for process isolation and parallelism with traditional CPython.threadingcan provide CPU parallelism with a free-threaded interpreter.- Shared mutable state still requires application-level synchronization. Internal container locks do not make a multi-step read-modify-write operation atomic; the GIL did not provide that general guarantee either.
Checking the running interpreter
On CPython 3.13 or newer, check both build support and runtime state after importing the extensions the application uses:
import sys
import sysconfig
print("Free-threaded build:",
sysconfig.get_config_var("Py_GIL_DISABLED") == 1)
print("GIL enabled:", sys._is_gil_enabled())Required state for parallel execution of Python bytecode within one interpreter:
Free-threaded build: True
GIL enabled: FalseSome third-party C extensions can automatically re-enable the GIL when imported. Free-threaded builds can also use more memory and have some single-thread performance overhead. 4, 5
The relevant specifications are PEP 703 (the implementation design) and PEP 779 (the move to official support).
Concurrency abstraction layers
Python already had locks, threads, futures, executors, and asynchronous tasks before free threading. Removing the GIL changes the execution capabilities underneath those APIs; it does not introduce the abstraction layers themselves.
Comparing the abstraction layers
The libraries have different designs and guarantees, so these are conceptual comparisons rather than direct equivalents.
Executors: one interface, different isolation models
Python’s concurrent.futures already offers an abstraction similar to Java’s ExecutorService. Python 3.14 added InterpreterPoolExecutor, bringing the standard library to three main executors:
All three expose the Executor interface, but task submission, data transfer, and shared-state assumptions differ. 6, 7
Structured concurrency and asyncio
Python introduced asyncio.TaskGroup in 3.11. It manages groups of asynchronous tasks, including completion, failures, and cancellation.
There’s an important distinction from Java’s virtual threads: asyncio uses cooperative scheduling, and one event loop normally runs Python tasks on one thread. It doesn’t automatically distribute CPU calculations across cores. 8, 9
Experimental directions
The February 2026 Python Language Summit report discusses higher-level primitives for coordinating parallel work. One model presented there was Behavior-Oriented Concurrency (BOC).
Its goal is to let developers express tasks and their data dependencies while a scheduler manages parallel execution and synchronization. The model uses ownership-aware containers called Cown to control access to shared state.
bocpy is the prototype associated with this work. Treat the summit discussion as an exploration of programming models, rather than an announcement that BOC is a standard-library API.
The distinction is between execution capabilities–threads, processes, and isolated interpreters–and programming models that coordinate task lifetimes and access to data. Free threading changes the former; it does not determine which higher-level model an application should use.
Sources
- PEP 779 - Criteria for supported status for free-threaded Python | peps.python.org
- Python support for free threading – Python 3.14.7 documentation
- Thread states and the global interpreter lock – Python 3.14.7 documentation
- Python support for free threading – Python 3.15.0 documentation
- What’s new in Python 3.15 – Python 3.15.0 documentation
- concurrent.futures – Launching parallel tasks – Python 3.15.0 documentation
- The concurrent package – Python 3.15.0 documentation
- Coroutines and tasks – Python 3.15.0 documentation
- Developing with asyncio – Python 3.15.0rc3 documentation
Library sources
Further reading:
- Marlow 2013, Parallel and Concurrent Programming in Haskell: chapter 1, “Terminology: Parallelism and Concurrency”, where parallelism uses several processors for speed while concurrency structures a program as several threads of control that may run on one core; the opening of chapter 13, “Parallel Programming Using Threads”, on overlapping I/O as a speedup without parallelism and on when concurrency must be used to get parallelism; on Concurrency abstraction layers and the closing distinction in Experimental directions.