MemotivaThe Global Interpreter Lock and concurrency

Why does CPython have a GIL?

Nortren·

Why does CPython have a GIL?

0:14

The GIL exists because CPython uses reference counting for memory management. Without a global lock, multiple threads modifying reference counts could corrupt them, leading to memory errors or crashes. The GIL trades multithread parallelism for simplicity and single-thread speed.
wiki.python.org