What is the Global Interpreter Lock (GIL)?
The GIL (Global Interpreter Lock) is a mutex in CPython that allows only one thread to execute Python bytecode at a time — even on multi-core machines.
CPython's memory management (reference counting) isn't thread-safe. The GIL is a simple fix — lock the interpreter, prevent race conditions.
Know what the GIL does (one thread executes Python bytecode at a time), why it exists (reference counting thread safety), and the workarounds (multiprocessing for CPU, asyncio for I/O). The Python 3.13 free-threaded mode shows you follow current developments.
This is the #1 Python concurrency question.