Skip to the page

Python concurrency · Concept

The GIL in 2026

The interviewer asks

What is the GIL? What does it stop, what doesn't it stop, and is it going away?

Then

Follow-ups the interviewer asks next

  1. If the GIL exists, why do threads speed up downloading 500 files?
  2. Does the GIL make counter += 1 safe?
  3. What is the free-threaded build, and would you run production on it today?
  4. How can NumPy-heavy code use many cores with threads?

The answer

What a strong answer covers

  • The Global Interpreter Lock lets one thread at a time run Python bytecode in a CPython process. It protects the interpreter's internals, such as reference counts.
  • Threads still help with I/O: the GIL is released while waiting on sockets, files and sleep, and many C libraries (NumPy, hashlib, zlib) release it during heavy work.
  • It doesn't make your code thread-safe: a compound step like += can still be interleaved.
  • CPU-bound pure Python doesn't scale with threads: use processes, C extensions, or subinterpreters.
  • Free-threaded build: PEP 703; experimental in 3.13; officially supported but optional in 3.14 (PEP 779), with about 5–10% single-thread overhead; 3.15 adds a stable ABI for it (abi3t). The default build still has the GIL; making free-threading the default is left to a future PEP.
  • On the free-threaded build, importing an extension that doesn't declare support turns the GIL back on; sys._is_gil_enabled() tells you.

The red pen

Common traps

Avoid:"the GIL makes Python code thread-safe"; "threads are useless in Python"; "the GIL was removed in 3.13".

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview