Python GIL

Python GIL stands for global interpreter lock. As the name suggests, GIL is the lock to get control of the python interpreter.

GIL ensures that only one thread is in the execution state at any point of the time.

Memory management in Python is done using reference counting however, the real challenge   is to protect the reference count variable against the race conditions so that no two threads increase or decrease reference counts value simultaneously.

Otherwise, there may be cases of memory leaks, or worst case the memory will be released for objects still having the reference alive.

GIL is a binary semaphore constructed from a mutex and a condition variable.



Do you want to get articles like these in your inbox?

Email *

Interested groups *
Technical articles