CPython uses a Global Interpreter Lock. Linux has removed all traces of the Big Kernel Lock. What is the alternative to these locks? How can a system make full use of a truly multi-core or multi-processor system without grinding everything to a halt?
A GIL wouldn't be necessary if python used a more advanced Garbage Collector like IBM's Recycler instated of a primitive reference counting method. This is something that Unladen Swallow is doing to improve the performance of python. A more prommising answer is Stackless Python, which uses its own micro-thread implementation instead of relying on the operating system like traditional CPython.
The GIL is process specific, so you can get around it by launching several Python processes. The multiprocessing module provides an easy-to-use API for this.
Another way is to use C-extensions (or write your own) which release the GIL while doing the kind of data processing you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With