Written for CPython 3.14.10 and 3.15.2, the current releases as of November 2026. Free-threading details follow the Python free-threading HOWTO.
A feature-extraction worker runs as eight processes on one box, and each process holds its own copy of a large lookup table. Someone rewrites it to use eight threads so the table loads once. Memory drops as planned. Throughput drops too, and the CPU graph shows roughly one core’s worth of work shared across eight threads.
That worker hit the Python GIL. It’s also why “Python can’t do parallelism” now loses points in a senior interview: CPython has shipped a supported build that runs threads in parallel since 3.14.
The scope here is the GIL itself, the free-threaded build and the choice between threads, processes, asyncio and interpreters. The upgrade to 3.14 (removed APIs, the grep pass before you bump the version, the garbage collector’s history) is covered in what’s new in Python 3.14, and typing, checkers and gradual adoption are in Python type hints.
The Python GIL still ships on by default: it lets one thread run Python bytecode at a time, so threads help I/O-bound code and do nothing for CPU-bound pure Python. Since 3.14, an officially supported free-threaded build removes that limit, and you opt into it per service after measuring.
What the Python GIL is and what it protects
The global interpreter lock (GIL) is the mechanism CPython uses so that only one thread executes Python bytecode at a time. The Python glossary says it makes the object model, including built-in types such as dict, implicitly safe against concurrent access, at the cost of much of the parallelism on multi-core machines. The GIL is a CPython implementation detail, so other Python implementations decide for themselves whether to have one.
A thread must hold the GIL to run bytecode. On a 16-core machine, four threads running a pure-Python loop still execute one at a time. You get concurrency, where tasks interleave, without parallelism, where tasks run at the same instant on separate cores.
CPython manages memory with reference counting. Every object carries a count of references to it, and the object is freed when that count hits zero. If two threads changed the same count at once without a lock, CPython could free an object that’s still in use or leak one that isn’t.
One global lock keeps those counts consistent without a lock on every object, and it lets C extension authors assume no other thread touches Python objects while their code holds the GIL. PEP 703, “Making the Global Interpreter Lock Optional in CPython,” covers this design and what it took to make the lock optional.
The GIL in other Python implementations
Three alternatives to CPython show how differently implementations answer the question:
- PyPy has a GIL. The PyPy FAQ says removing it is very hard, and that work on a Software Transactional Memory version meant to run without one has stalled.
- Jython has no GIL. The Definitive Guide to Jython explains that Python threads map to Java threads and use the JVM’s garbage collection.
- GraalPy implements a GIL, and its interoperability docs say it releases the lock by default around calls into other languages such as Java.
For a service already on CPython with C extension dependencies, changing implementations is a much bigger move than changing CPython builds, which is why the rest of this article stays with CPython.
What the GIL doesn’t protect
The GIL protects the interpreter’s internals. It doesn’t protect your program logic, and compound operations in your code can race on the standard build.
import threading
counter = 0
def bump(n):
global counter
for _ in range(n):
counter += 1 # read, add, write: three steps
threads = [threading.Thread(target=bump, args=(100_000,)) for _ in range(4)]
for t in threads:
t.start()
for t in threads:
t.join()
print(counter) # not guaranteed to be 400000
counter += 1 reads the value, adds one, and writes it back. A thread switch can land between the read and the write, so two threads can read the same value and one update gets lost. Check-then-set on a dict (if key not in d: d[key] = make()) has the same problem: two threads can both see the key missing.
The fix is the same on either build. Wrap the compound operation in a threading.Lock.
When the GIL gets released
The GIL is always released during I/O. A thread waiting on a socket read, a database query, or a file write drops the lock, and another thread runs Python code in the meantime. That’s why a thread pool making HTTP calls scales on the standard build, and why calls to model APIs in an AI pipeline, which spend most of their time waiting on the network, fit threads or asyncio.
C extensions can also release the GIL while their native code runs. The glossary names compression and hashing as typical cases. The hashlib docs say the GIL is released while computing a hash over more than 2047 bytes of data passed at once.
On the free-threaded build, extensions have to declare that they support running without the GIL. The C API extension HOWTO for free threading shows the Py_mod_gil slot set to Py_MOD_GIL_NOT_USED. Without that marker, importing the extension turns the GIL back on.
How threads take turns: the switch interval
I/O is one release point. The other is a timer. The thread switch interval sets the ideal length of each thread’s timeslice on the GIL, and the What’s New in Python 3.2 entry that introduced it gives the default as 5 milliseconds. sys.getswitchinterval() and sys.setswitchinterval() read and change it, in seconds:
import sys
print(sys.getswitchinterval()) # 0.005 by default
sys.setswitchinterval(0.02) # longer timeslices, fewer GIL handoffs
print(sys.getswitchinterval()) # 0.02
The sys docs add two caveats: a slice can run longer when a thread is inside a long-running internal function, and the operating system picks which thread runs next, since the interpreter has no scheduler of its own.
This is the mechanism behind the worker in the opening. Its eight threads take turns holding one lock in slices of about 5 ms, so the work of eight threads squeezes through one core plus the cost of every handoff. Raising the interval trims handoffs and never adds a second core. Lowering it lets an I/O thread stuck behind CPU-bound threads get the lock back sooner, at the price of more switching. It’s a single interpreter-wide setting, so treat it as a latency knob for mixed workloads and measure before you change it.
A Python GIL explanation in one table
The GIL hurts CPU-bound pure-Python threads and barely touches I/O-bound threads.
| Workload | Effect of the GIL on the standard build | Effect on the free-threaded build |
|---|---|---|
| I/O-bound network calls | Small, because the GIL is released while threads wait on I/O | Similar to the standard build |
| CPU-bound pure Python | Threads run one at a time, so no multi-core speedup | Threads can run in parallel on separate cores |
| CPU-bound work in C extensions that release the GIL | Threads run in parallel inside the C code | Parallel, if the extension is marked as supporting free-threading |
| Single-threaded scripts | No cost | Roughly 5 to 10% slower in 3.14 |
| Code with shared mutable state | Compound operations can still race | Same races, with more interleavings that can expose them |
CPU-bound tasks spend their time running bytecode, and running bytecode needs the GIL. The threading docs say only one thread can execute Python code at once in CPython, and they point you to multiprocessing or ProcessPoolExecutor for multi-core work. Threading stays an appropriate model for running many I/O-bound tasks at the same time.
A service that parses JSON, scores records in a Python loop, and builds feature vectors gains nothing from eight threads on the standard build. It pays the switching overhead and gets no extra cores, which is exactly what happened to the worker in the opening.
How free-threading changed in Python 3.13, 3.14, and 3.15
Free-threading went from experimental in 3.13 to officially supported in 3.14, and 3.15 made it easier for extensions to ship for it. It still isn’t the default.
| Version | Release date | Free-threading status | What changed |
|---|---|---|---|
| 3.13 | October 7, 2024 | Experimental (PEP 703) | Separate python3.13t executable; optional binaries in the Windows and macOS installers; build from source with –disable-gil |
| 3.14 | October 7, 2025 | Officially supported, optional (PEP 779) | Single-thread penalty roughly 5 to 10%; specializing adaptive interpreter enabled in free-threaded mode |
| 3.15 | October 9, 2026 | Supported, optional, not the default | abi3t Stable ABI for free-threaded builds (PEP 803); macOS installer includes free-threading by default |
Python 3.13: the experimental build
What’s New in Python 3.13 introduced an experimental free-threaded build under PEP 703. People informally call it “nogil.” It ships as a separate executable, usually python3.13t, and you can build it from source with the –disable-gil configure option.
The 3.13 release notes warned of “a substantial single-threaded performance hit” and labeled the mode experimental, which made it a test target for library authors rather than a production option.
Python 3.14: officially supported, still optional
What’s New in Python 3.14 moved the free-threaded build to officially supported. The single-threaded penalty dropped to roughly 5 to 10%, depending on the platform and C compiler, and the specializing adaptive interpreter (PEP 659) now runs in free-threaded mode.
The standard python3.14 binary still has the GIL. PEP 779, accepted on June 16, 2025, set the criteria for supported status, and it leaves making the free-threaded build the default (phase III) to a future PEP.
You can check which build you’re on and whether the GIL is on right now:
import sys
import sysconfig
print(sys.version) # includes "free-threading build" on python3.14t
print(sysconfig.get_config_var("Py_GIL_DISABLED")) # 1 on the free-threaded build
print(sys._is_gil_enabled()) # False when the GIL is off in this process
The _ prefix marks sys._is_gil_enabled() as private, but the free-threading HOWTO documents it as the check. On the free-threaded build, the GIL turns back on, with a warning, when the interpreter imports a C extension that isn’t marked as supporting free-threading.
The command-line docs cover forcing the setting either way:
PYTHON_GIL=0 python3.14t service.py # force the GIL off
python3.14t -X gil=1 service.py # force the GIL on
Setting 0 only works on a free-threaded build, and -X gil takes precedence over PYTHON_GIL. Use 0 to override the automatic re-enable only after you’ve confirmed the extension is safe, because otherwise unmarked C code runs in parallel.
Python 3.15: a stable ABI for free-threaded builds
In 3.14, the free-threaded build doesn’t support the Limited C API or the Stable ABI, so each extension needs a separate cp314t wheel. What’s New in Python 3.15 adds abi3t, a Stable ABI for free-threaded builds (PEP 803). Extensions get there by switching to the PyModExport_* export hook from PEP 793 and the PySlot structure from PEP 820. Porting usually takes non-trivial source changes, and extensions that can’t switch keep building abi3 plus a separate cp315t wheel.
The macOS install guide for 3.15 says the python.org installer now installs a free-threaded build by default, alongside the standard one, as python3.15t. The two builds keep separate site-packages directories, so you install packages in each.
Choosing between threads, processes, and asyncio today
Match the model to where your time goes: waiting on I/O or burning CPU. Profile first, then use this table.
| Workload | Best fit today | Why | Watch out for |
|---|---|---|---|
| Many concurrent network or database calls | asyncio, or threads if the codebase is synchronous | Waiting releases the GIL; one event loop handles many sockets | Blocking calls inside async code |
| CPU-bound pure Python, no shared state | ProcessPoolExecutor on the standard build; ThreadPoolExecutor on python3.14t as a measured pilot | Processes sidestep the GIL; free-threaded threads share memory | Pickling cost; unmarked extensions turning the GIL back on |
| CPU-bound work in C extensions that release the GIL | Threads on the standard build | The heavy work runs outside the lock | Python glue between calls still runs one thread at a time |
| Isolated work without separate processes | InterpreterPoolExecutor | Each interpreter has its own GIL | Many third-party extensions aren’t compatible yet |
| Mixed services | Keep the current model; pilot free-threading on one worker type | Limits the blast radius | Comparing builds under different loads |
Threads
Use threads for blocking I/O in synchronous code and for C extension work that releases the GIL. ThreadPoolExecutor in concurrent.futures is the cleanest entry point. Since 3.13, its default max_workers is min(32, (os.process_cpu_count() or 1) + 4).
The failure modes are shared state and hidden CPU work. Lost updates, check-then-set races, and one iterator shared across threads (which can yield duplicate or missing items on the free-threaded build) all need a lock or a queue.Queue.
Processes
Reach for processes when the CPU-bound code is pure Python and the build is the standard one. Each worker process has its own interpreter and its own GIL, so work runs in parallel across cores.
You pay for it. Arguments and results must be picklable, each process holds its own memory, and starting workers takes time. In 3.14, the default start method on Unix platforms other than macOS changed from fork to forkserver, and macOS and Windows still use spawn. Code that relied on globals inherited through fork can break after an upgrade.
Asyncio
The asyncio docs describe it as “often a perfect fit for IO-bound and high-level structured network code.” It runs every task on one event loop thread.
That single thread is the catch. One blocking call (a synchronous database driver, time.sleep, a heavy parse) stalls every task, so push those calls to a thread with await asyncio.to_thread(func, arg). In 3.14, python -m asyncio ps PID and python -m asyncio pstree PID show running tasks, and the asyncio policy system is deprecated and scheduled for removal in 3.16, which hasn’t shipped as of November 2026.
Multiple interpreters
InterpreterPoolExecutor (PEP 734, new in 3.14) gives each worker thread its own interpreter, and each interpreter has its own GIL. You get multi-core parallelism inside one process.
The limits are real. Many third-party extension modules aren’t compatible yet, interpreters can’t share mutable objects, and the executor pickles the callable, arguments, and return values as they cross between interpreters. Here are the three executors running the same function. Put the function in work.py so every worker can import it:
# work.py
def count_primes(limit):
return sum(all(n % d for d in range(2, int(n**0.5) + 1))
for n in range(2, limit))
import time
from concurrent.futures import (ThreadPoolExecutor, ProcessPoolExecutor,
InterpreterPoolExecutor)
from work import count_primes
if __name__ == "__main__":
for pool in (ThreadPoolExecutor, ProcessPoolExecutor, InterpreterPoolExecutor):
start = time.perf_counter()
with pool(max_workers=4) as ex:
list(ex.map(count_primes, [200_000] * 4))
print(pool.__name__, f"{time.perf_counter() - start:.2f}s")
Run it with python3.14 and again with python3.14t, on an idle machine, several times each. Compare wall-clock time per executor across the two builds and keep your own numbers.
How to test free-threaded Python on an existing service
Test one service at a time and check three things: the build and GIL state, your dependencies and shared objects, and a fair benchmark.
Check the build and runtime GIL state
Check at startup and in your logs, because the GIL can switch back on after an import:
python3.14t -VV
python3.14t -c "import sys, sysconfig;
print(sysconfig.get_config_var('Py_GIL_DISABLED'), sys._is_gil_enabled())"
Py_GIL_DISABLED of 1 means the build supports free-threading. sys._is_gil_enabled() returning True mid-run means an import turned the lock back on. Log that value after your imports finish.
Check extensions and shared objects
Check every dependency, including transitive ones in your data stack, for free-threaded (cp314t) wheels. Don’t assume any library is ready; check each one’s release files.
Then audit shared mutable state. The free-threading HOWTO says built-in types like dict, list, and set use internal locks, but it recommends threading.Lock over relying on them, and your compound operations still need one. Never read frame.f_locals from a frame running in another thread, which can crash the interpreter.
Measure a CPU-bound workload
Pin the patch version on both sides of the comparison before you read any memory numbers. The What’s New in Python 3.14 garbage collection section says 3.14.0 to 3.14.4 shipped an incremental garbage collector, and 3.14.5 reverted to the generational collector from 3.13 after reports of significant memory pressure in production. What’s New in Python 3.15 confirms 3.15 keeps the generational collector, and the core team’s reasoning is in the discuss.python.org thread Reverting the incremental GC in Python 3.14 and 3.15. A python3.14t pilot on 3.14.3 compared with a standard baseline on 3.14.10 measures a collector change as well as the GIL, so a memory difference could come from the GC rather than from free-threading.
Use a short, repeatable plan:
- Pick one CPU-bound service, such as a preprocessing or feature-extraction worker.
- Install python3.14t next to your standard build, both on the same patch release (3.14.5 or later), and log sys.version with every result.
- Run the test suite under python3.14t and treat the GIL re-enable warning as a failure.
- Load-test both builds with the same traffic.
- Compare throughput, p99 latency, and memory.
- Decide go or no-go, and recheck blocked extensions as they adopt abi3t in 3.15.
Go only if every check holds:
- sys._is_gil_enabled() stays False under load
- Every dependency ships a free-threaded wheel
- Shared state is locked, and tests pass repeatedly
- The throughput gain outweighs the roughly 5 to 10% single-thread cost
- p99 latency and memory stay within budget
Python GIL interview questions that show current knowledge
These questions separate candidates who know how the GIL works today from those repeating a 2020 answer. They slot into a screen for Python developers on any team running concurrent services, and they work best live, on a shared editor, the way Arc’s guide to running a remote technical interview sets one up. For general prompts beyond Python, see Arc’s software engineer interview questions.
Does the GIL make my code thread-safe?
A strong answer says no: the GIL protects interpreter internals, and compound operations like counter += 1 or check-then-set still race, so shared state needs a lock. The red flag is “yes, that’s what it’s for.”
Is the GIL gone in Python 3.14?
A strong answer says the free-threaded build is officially supported but optional, and the default interpreter still has the GIL. Bonus points for mentioning abi3t in 3.15. The red flag is either “yes, 3.14 removed it” or “Python can’t run threads in parallel, period.”
When would you use threads for CPU-bound work?
A strong answer names C extension work that releases the GIL, such as hashing large buffers, or the free-threaded build after measuring. The red flag is a blanket rule in either direction.
What breaks when you move a service to python3.14t?
A strong answer covers dependencies without free-threaded wheels turning the GIL back on, races the GIL used to hide, and the roughly 5 to 10% single-thread slowdown. A candidate who also asks which 3.14 patch release the benchmark ran on, because of the GC change, has done this before. The red flag is “nothing, it just gets faster.”
Who you need for concurrency work
A free-threading pilot needs people who can profile to separate CPU-bound from I/O-bound code, debug race conditions, and read C extension packaging. Look for engineers who know which workloads the GIL limits, can find race conditions the GIL used to hide, check C extension dependencies for free-threaded wheels, and load-test before and after a change.
Back-end developers own the code changes: finding shared state, adding locks, and checking each dependency’s wheels.
DevOps engineers run the load tests and keep two builds side by side in CI and deploys.
For a fixed-length pilot, compare freelance vs full-time costs and check current Python developer hourly rates before you decide how to staff it. If you’re comparing sourcing options, Arc’s guide to the best platforms to hire Python developers covers the tradeoffs.
Frequently asked questions
What is the Python GIL?
The Python GIL is the lock that lets only one thread execute Python bytecode at a time in CPython. It keeps reference counts and built-in objects consistent. CPython releases it during I/O, which is why threaded network code still overlaps well on the standard build.
Is the GIL removed in Python 3.14?
The default 3.14 interpreter keeps the GIL. The free-threaded build, python3.14t, is officially supported but optional, and you install or select it separately. Python 3.15 keeps that arrangement, though its macOS installer now installs the free-threaded build by default alongside the standard one.
Does removing the GIL make Python faster?
Only for CPU-bound multithreaded code that can spread across several cores. Single-threaded code runs roughly 5 to 10% slower on the 3.14 free-threaded build, depending on platform and compiler. I/O-bound services see little change, since waiting on I/O already released the lock.
Should I use threads, processes, or asyncio?
Use asyncio or threads for I/O-bound work like HTTP and database calls. Use processes for CPU-bound pure Python on the standard build. Move CPU-bound work to threads on the free-threaded build only after you’ve measured throughput, latency, and memory against your current setup.
Will free-threading become the default in Python?
That hasn’t been decided yet. PEP 779 made the free-threaded build supported and kept it optional. Making it the default interpreter, called phase III, needs a separate future decision, so plan your production services around the standard build for now.
What the GIL means for your next concurrency decision
Keep asyncio or threads for I/O-bound services. Keep processes for CPU-bound pure Python on the standard build. Treat the free-threaded build as a measured pilot for CPU-bound services whose dependencies ship free-threaded wheels, and benchmark both builds on the same 3.14.5 or later patch.
Python 3.14 is a stable target for that pilot: 3.14.10 is the current patch, released October 25, 2026, the next bugfix release is expected December 1, 2026, and security fixes run until about October 2030, per PEP 745.
Arc can staff the pilot with Python engineers from the top 2% of vetted talent, hired in 72 hours for freelance work or 14 days for full-time roles, and you pay $0 until you hire.








