# Python GIL: why threads are not truly parallel

> On default CPython, one thread runs bytecode at a time. Threads still help for I/O; free-threading stays optional.

Source: https://fullbytedeveloper.com/blog/python-gil-threads-not-parallel
Published here: 2026-11-20, updated 2026-12-03

On default CPython builds, the global interpreter lock means only one thread runs Python bytecode at a time, so CPU-bound pure-Python threads do not get true multi-core speedup [1][3]. Threads still help when work is mostly waiting on I/O, because the GIL is released during those waits. Free-threaded builds exist, but they stay optional.

## Quick start: print whether your build still has the GIL

```bash
python3 - <<'PY'
import sys, sysconfig
print("version:", sys.version.split()[0])
print("Py_GIL_DISABLED:", sysconfig.get_config_var("Py_GIL_DISABLED"))
print("has _is_gil_enabled:", hasattr(sys, "_is_gil_enabled"))
if hasattr(sys, "_is_gil_enabled"):
    print("gil enabled now:", sys._is_gil_enabled())
PY
```

Captured on this host:

```text
version: 3.12.3
Py_GIL_DISABLED: None
has _is_gil_enabled: False
```

That is a classic GIL build. Free-threaded builds advertise themselves in `sys.version` with `free-threading build`, expose `sys._is_gil_enabled()`, and set `Py_GIL_DISABLED` to `1` [4].

## Time CPU-bound pure Python on two threads

```bash
python3 - <<'PY'
import threading, time

N = 8_000_000

def cpu_work():
    x = 0
    for i in range(N):
        x += i
    return x

t0 = time.perf_counter()
cpu_work()
cpu_work()
print(f"CPU sequential two runs: {time.perf_counter() - t0:.3f}s")

t0 = time.perf_counter()
th1 = threading.Thread(target=cpu_work)
th2 = threading.Thread(target=cpu_work)
th1.start(); th2.start()
th1.join(); th2.join()
print(f"CPU two threads: {time.perf_counter() - t0:.3f}s")
PY
```

Captured on the same host (one trial). Sandbox capture on the review host; re-run on your box before you treat the numbers as a lab result.

```text
CPU sequential two runs: 0.376s
CPU two threads: 0.401s
```

Two threads did not finish in about half the sequential time. Here they took slightly longer. Label that as one machine, one build, one day. Re-run before you quote your own numbers. Glossary wording: the GIL assures that only one thread executes Python bytecode at a time [1]. Threading docs advice for CPU-bound work on GIL builds: use `multiprocessing` or `concurrent.futures.ProcessPoolExecutor` [3].

## Time overlapping I/O waits

```bash
python3 - <<'PY'
import threading, time

def io_work():
    time.sleep(0.4)

t0 = time.perf_counter()
io_work(); io_work()
print(f"IO sequential two sleeps: {time.perf_counter() - t0:.3f}s")

t0 = time.perf_counter()
th1 = threading.Thread(target=io_work)
th2 = threading.Thread(target=io_work)
th1.start(); th2.start()
th1.join(); th2.join()
print(f"IO two threads: {time.perf_counter() - t0:.3f}s")
PY
```

Captured:

```text
IO sequential two sleeps: 0.800s
IO two threads: 0.401s
```

Overlapping waits finished near one sleep duration. Glossary: the GIL is always released when doing I/O; some extensions also release it for heavy C work such as compression or hashing [1]. Do not turn that into a universal "threads are 2x faster" law.

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 280" role="img" aria-label="Dark diagram: Thread A box holds the GIL and runs bytecode while Thread B and Thread C boxes wait for the GIL, with a lower I/O band stating blocking I/O releases the lock so waits can overlap, no people.">
  <defs>
    <marker id="gilArrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="280" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">classic CPython GIL</text>
  <rect x="24" y="56" width="200" height="88" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="40" y="88" fill="#14b8a6" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Thread A</text>
  <text x="40" y="112" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">holds GIL, runs bytecode</text>
  <path d="M232 100 H280" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#gilArrow)"/>
  <rect x="288" y="56" width="200" height="88" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="304" y="88" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Thread B</text>
  <text x="304" y="112" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">waits for GIL</text>
  <rect x="512" y="56" width="184" height="88" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="528" y="88" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Thread C</text>
  <text x="528" y="112" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">waits for GIL</text>
  <rect x="24" y="168" width="672" height="84" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="40" y="200" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">I/O path</text>
  <text x="40" y="228" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">blocking I/O releases the GIL so waits can overlap on one process [1][3]</text>
</svg>
</figure>

*Dark diagram of Thread A holding the GIL to run bytecode while Thread B and Thread C wait for the lock. The lower I/O band shows blocking I/O releasing the GIL so waits can overlap on one process without true multi-core CPU speedup.*

## Date the free-threading status from python.org

PEP 703 made an optional free-threaded CPython build possible in 3.13 via `--disable-gil` [5]. The official howto: starting with 3.13, free-threaded builds can run threads in parallel on available cores; macOS and Windows installers can optionally ship those binaries; third-party extension modules may re-enable the GIL [4]. Runtime can still force the GIL with `PYTHON_GIL` or `-X gil` [4].

PEP 779 (Final, Python-Version 3.14, resolution 16-Jun-2025): Phase II means the free-threaded build is officially supported but still optional. Phase III (making it the default) is explicitly left for a future PEP [6]. Threading docs: as of 3.13, free-threaded builds can disable the GIL, but the feature is not available by default [3].

## Pick the API that matches the bottleneck

For pure-Python CPU work on a classic GIL build, prefer processes via `ProcessPoolExecutor` rather than more threads [3]. Vocabulary for the review: overlapping waits are concurrency; same-time multi-core CPU progress is parallelism, as in [concurrency vs parallelism in plain words](/blog/concurrency-vs-parallelism-plain).

## Mistakes that show up in PR reviews

Adding more threads to a pure-Python CPU hot path and calling the result "parallel." Measure wall time against a sequential baseline first [1][3].

Treating free-threaded Python as already the default on every laptop. Check `Py_GIL_DISABLED` and the howto markers [4][6].

Using threads for CPU work when the docs already point at `multiprocessing` [3].

Confusing asyncio Tasks with multi-core speedup. Tasks still run on one event loop thread unless you offload elsewhere. See [Python create_task vs await](/blog/python-create-task-vs-await) and [Python async def is lazy until you await](/blog/python-async-def-is-lazy).

Claiming all extensions release the GIL. Many do for I/O; verify the extension you ship [1][7].

## Depth: what the lock actually protects

The glossary describes the GIL as a mutex that protects access to Python objects and prevents multiple threads from executing Python bytecode at once [1]. The C API docs cover how extension authors acquire and release the lock around non-Python work [7]. That is why a compression library written in C can use multiple cores inside one call while your pure-Python loop cannot.

Production systems that outgrew one runtime's concurrency story often move hot paths into languages with different ownership models. Discord's public engineering writeup on scaling with Rust is one company example of that pressure; it is not a claim that you must leave Python to finish this page [8]. For a Go-side comparison of structure versus cores, see [goroutines vs Python coroutines](/blog/goroutines-vs-coroutines).

## Re-run the demos before you quote numbers

Change `N`, change the host, or change the Python patch version and the CPU timings move. Keep the I/O demo near fixed sleeps so the overlap story stays obvious. When you write a design note, paste both the GIL probe and the two timing blocks so reviewers see the build class and the measured shape on the same day [1][3][4].

If someone asks "should we enable free-threading tomorrow," answer with the PEP 779 phase line: supported, optional, default still undecided [6]. Then point at the extension modules you depend on, because those packages may force the GIL back on even inside a free-threaded build [4].

## Threads still share one process

Threads share an address space. The GIL limits bytecode concurrency; it does not invent process isolation. Shared mutable lists still need locks or queues even when the GIL serializes bytecode steps [3]. Processes give separate interpreters and separate heaps at the cost of pickling and IPC. Prefer that cost when the profiler shows CPU, not when the profiler shows wait.

A practical review question: "Are we overlapping waits, or trying to finish CPU work sooner?" Waits point at threads or asyncio. CPU points at processes, native extensions, or a verified free-threaded build [1][3][4]. Write the answer in the PR description so the review stays on the right layer.

## What "released around I/O" means in practice

When a thread hits a blocking read, sleep, or similar wait, CPython can release the GIL so another thread runs bytecode [1][7]. That is why two `time.sleep` calls overlap. A tight pure-Python loop never reaches that release point, so a second thread mostly waits for the lock. Extensions that do heavy C work can also release the lock for the duration of the C call; that is an extension property, not a property of every `import` [1][7].

If your hot path is numpy, hashing, or compression inside a well-behaved extension, threads may help for that slice. If your hot path is a Python `for` loop over Python objects, measure before you multiply workers.

Browse the [Dev explainers topic](https://fullbytedeveloper.com/blog/topic/dev-explainers).

Send this to the friend who added threads to Python code and saw no speedup.

Image: Several teal thread ribbons approach a single glowing amber mutex ring around one central core, with only one ribbon passing through at a time while others wait, and a side tunnel letting one ribbon slip around the ring, on a dark navy field with no typography.
https://fullbytedeveloper.com/media/python-gil-threads-not-parallel/python-gil-threads-not-parallel-venice.webp
One bytecode core at a time. Threads still help when they spend time waiting on I/O.

## Sources

1. [Python glossary: global interpreter lock, accessed 2026-11-20](https://docs.python.org/3/glossary.html#term-global-interpreter-lock)
2. [Python glossary: free threading / free-threaded build, accessed 2026-11-20](https://docs.python.org/3/glossary.html)
3. [Python docs: threading (GIL note), accessed 2026-11-20](https://docs.python.org/3/library/threading.html)
4. [Python HOWTO: free-threading Python, accessed 2026-11-20](https://docs.python.org/3/howto/free-threading-python.html)
5. [PEP 703: Making the GIL Optional in CPython, accessed 2026-11-20](https://peps.python.org/pep-0703/)
6. [PEP 779: Free-threaded Python is officially supported, accessed 2026-11-20](https://peps.python.org/pep-0779/)
7. [Python C API: thread states and the GIL, accessed 2026-11-20](https://docs.python.org/3/c-api/threads.html)
8. [Discord Engineering: Using Rust to Scale Elixir for 11 Million Concurrent Users, accessed 2026-11-20](https://discord.com/blog/using-rust-to-scale-elixir-for-11-million-concurrent-users)
