Beyond the GIL: Future of Parallel Computing in Python
Last year The Python Steering Council accepted PEP-703. Those who wanted to know more about this enhancement proposal can read PEP-703, but for an quick overview this PEP propose adding build configuration in CPython to let it run Python code without GIL.
I am assuming python enthusiastic reading this blog are familiar with what is GIL, if not this official python wiki page has explanation about it. GIL has been part of Python since it’s inception. It was introduced in the very first version of Python, Python 0.9.0, released in Feb 1991. It was originally implemented by Guido van Rossum, Python’s creator, as a straightforward solution to manage memory in early versions of Python, particularly for the reference counting mechanism used in Python’s memory management.
Despite it’s advantages in terms of simplicity and ease of implementation, the GIL has inherent limitations, particularly in the realm of multi-threading. While it provides safety for the reference counting system, it also restricts Python’s ability to leverage multi-core processors effectively.
But as Python evolved, the need to address the GIL’s limitations has become increasingly apparent, especially with raise of AI and need of heavy scientific computing tasks.