... continued
Understand the role of Python's Global Interpreter Lock in managing thread execution and why it remains in place despite limitations. This lesson explains the GIL's design, its impact on CPU-bound and I/O-bound tasks, and introduces Python implementations that avoid the GIL for improved concurrency.
We'll cover the following...
Removing GIL
One may wonder why the GIL can't be removed from Python because of the limitations it imposes on CPU-bound programs. Attempts at removing GIL resulted in breaking C extensions and degrading the performance of single and multithreaded I/O bound programs. Therefore, so far GIL hasn't been removed from Python.
Python's GIL is intended to serialize access to interpreter internals from different threads. In summary, threads in Python are only good for blocking I/O. While N threads are blocked on network or disk I/O or just waiting to reacquire the GIL, one thread runs in the Python ...