The story of GIL
What if someone told you that, even though you have created a multithreaded program, only a single thread can execute at a time? This situation used to be true when systems consisted of a single core that could execute only one thread at a time, and the illusion of multiple running threads was created by the CPU switching between threads frequently.
But this situation is also true in one of the implementations of Python. The original implementation of Python, also known as CPython consists of a global mutex also known as a GIL, which allows only one thread to execute the Python bytecode at a time. This effectively limits the application to executing only one thread at a time.
The GIL was introduced in CPython because of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access