Python 3.13 Releases Free-Threaded Execution and Experimental JIT: The Death of the GIL

Python 3.13 Releases Free-Threaded Execution and Experimental JIT: The Death of the GIL

After more than three decades of community debate and engineering research, the Global Interpreter Lock (GIL)—the historic mutex that prevented CPython threads from executing in true parallel across CPU cores—has officially been made optional in Python 3.13, alongside an experimental copy-and-patch JIT compiler.

Biased Reference Counting and True Thread Parallelism

Spearheaded by PEP 703 and key contributions from Meta and the Python core team, the free-threaded build replaces global locks with biased reference counting and mimalloc thread-local memory allocators. Pure computational threads now scale linearly across 64-core server chips.

  • True Multi-Threaded Concurrency: High-throughput worker threads execute in parallel without requiring multi-process IPC overhead.
  • Copy-and-Patch JIT: Compiles Python bytecode into machine code templates with near-zero compilation overhead.
  • Scientific Computing Boost: Direct speedups for NumPy, PyTorch, and Polars parallel array manipulations.

Running Python in Free-Threaded Mode

# Run Python 3.13 without the Global Interpreter Lock
python3.13t -X gil=0 script.py

# Check status inside runtime
import sys
print("GIL Enabled:", sys._is_gil_enabled()) # False

While C-extension maintainers adapt their codebases to thread-safe conventions, Python 3.13 establishes a clear runway for high-performance enterprise systems to standardize on Python for both glue code and intensive compute.

Tags

#python-313 #no-gil #free-threaded #jit-compiler #performance #concurrency