Programming

What is the Global Interpreter Lock (GIL) in Python?

Short answer

The GIL is a lock in the standard Python interpreter that allows only one thread to execute Python bytecode at a time, even on a multi-core processor.

This means that in standard CPython (the most common Python implementation), true parallel execution of Python code across multiple CPU cores isn't possible within a single process, even if you use multiple threads.

Why the GIL exists

The GIL simplifies memory management in CPython, since it prevents multiple threads from modifying Python objects simultaneously, avoiding certain categories of bugs and making the interpreter's internals simpler and faster for single-threaded code.

How developers work around it

The GIL is specific to CPython — it's an implementation detail, not a requirement of the Python language itself.

Last reviewed: September 2026