# Global Interpreter Lock (GIL)

> A lock in Python that lets one thread run Python code at a time.

**Field:** Software Development  
**Category:** Compilers & Runtimes  
**Also known as:** GIL, Python GIL

## Think of it like

Think of it like a talking stick. Only the one holding it may speak.

## Definition

The global interpreter lock, or GIL, is a lock inside standard Python. It lets only one thread run Python code at a time, even on a chip with many cores. Threads still help while code waits on files or the network, because a waiting thread lets go of the lock. Python 3.13 added a build with no GIL. Python 3.14 made that build fully supported, but it is still not the default.

## Example

Emma runs a maths job in 4 threads on a 4-core laptop. It takes as long as 1 thread, because of the GIL. With 4 processes, each with its own GIL, it ends far sooner.

## Example code

```python
>>> import sys
>>> sys._is_gil_enabled()
True
```

Python 3.13 and later can tell you if the GIL is on. On the usual build, it is.

## Why it matters

It is why threads rarely make Python maths faster. Python code uses processes for heavy work instead.

## Common mistake

Thinking the GIL makes your own code safe with threads. It guards Python's insides, not your data, so you still need locks.

## Three principles

- **One thread at a time.** For running Python code.
- **Let go while waiting.** Files and network still overlap.
- **Optional since 3.13.** A build with no GIL exists.

## Related terms

- [Mutex (Lock)](https://learn.benibix.com/term/development/mutex)
- [Thread](https://learn.benibix.com/term/development/thread)
- [Process](https://learn.benibix.com/term/development/process)
- [Parallelism](https://learn.benibix.com/term/development/parallelism)
- [Python](https://learn.benibix.com/term/development/python)

---

Source: https://learn.benibix.com/term/development/global-interpreter-lock
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
