👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
I"m hoping someone can provide some insight as to what"s fundamentally different about the Java Virtual Machine that allows it to implement threads nicely without the need for a Global Interpreter Lock (GIL), while Python necessitates such an evil.
👻 Read also: what is the best laptop for engineering students?
Why is there no GIL in the Java Virtual Machine? Why does Python need one so bad? global interpreter lock: Questions
What is the global interpreter lock (GIL) in CPython?
What is a global interpreter lock and why is it an issue?
A lot of noise has been made around removing the GIL from Python, and I"d like to understand why that is so important. I have never written a compiler nor an interpreter myself, so don"t be frugal with details, I"ll probably need them to understand.
Python"s GIL is intended to serialize access to interpreter internals from different threads. On multi-core systems, it means that multiple threads can"t effectively make use of multiple cores. (If the GIL didn"t lead to this problem, most people wouldn"t care about the GIL - it"s only being raised as an issue because of the increasing prevalence of multi-core systems.) If you want to understand it in detail, you can view this video or look at this set of slides. It might be too much information, but then you did ask for details :-)
Note that Python"s GIL is only really an issue for CPython, the reference implementation. Jython and IronPython don"t have a GIL. As a Python developer, you don"t generally come across the GIL unless you"re writing a C extension. C extension writers need to release the GIL when their extensions do blocking I/O, so that other threads in the Python process get a chance to run.