I have concerns that if such functionality will not be in the main release enabled by default(and consequently don't get as much testing), it will just bitrot and in the end, will be removed.
Let's Remove the Global Interpreter Lock
181–190 of 326 posts
Re: Let's Remove the Global Interpreter Lock
#182If done as a separate release, will that version be maintained in the future?
Re: Let's Remove the Global Interpreter Lock
#183Earlier quoted context omitted.
I agree wholeheartedly. Almost every time I hear from someone who is upset about the GIL, I find that they would be much better suited to using multiprocessing instead of multithreading. With 80% of the developers out there, they are basically assured of producing better, more stable code this way.
Python's "multiprocessing" means launching another Python interpreter in a subprocess. Each process has a full copy of the Python environment. They may share the base interpreter, but there's a separate copy of every package loaded and all data. Memory consumption is bloated and the CPU caches thrash. Launching a subprocess is expensive; it means a full interpreter launch and a recompile/reload. "Multiprocessing" is…
Re: Let's Remove the Global Interpreter Lock
#184>fully working PyPy interpreter with no GIL as a release, possibly separate from the default PyPy release I have concerns that if such functionality will not be in the main release enabled by default(and consequently don't get as much testing), it will just bitrot and in the end, will be removed.
A fully functional PyPy that could do heavy math in multiple threads would be an amazing tool in the box, but there are plenty of risks to that (penalizing single threaded performance, for example). So this strategy makes plenty of sense to me.
They can't just do it on mainline from the outset because there are huge obstacles to overcome.. for example, that ancient foe, CPython extension interface compatibility, which assumes a single global lock covering all mutable extension data. I don't think there will ever be a way around maintaining the GIL for that, even if pure Python code can freewheel it otherwise
Re: Let's Remove the Global Interpreter Lock
#185Earlier quoted context omitted.
Can't this already be handled by calling out to a C/C++ or FORTRAN procedure that processes the data in multiple threads? For number crunching, Python is almost exclusively used as glue.
You CAN handle it, but why should you have to? If it's possible to remove that barrier, then it absolutely should be removed. If the only answer to a problem is "use another language", then the language in question has a limitation that needs to be addressed.
Re: Let's Remove the Global Interpreter Lock
#186Earlier quoted context omitted.
in what was is it a pain that threading is not?
With threading, all of your threads can refer to the same objects. Multiprocessing means you have multiple interpreters running. That means no shared memory, and communication over pretty slow queues. I've definitely wanted to have multithreaded Python programs where all threads referred to the same large read-only data structure. But I can't do this because of the GIL. I mean, I can, but it's pointless. I can't do t…
Re: Let's Remove the Global Interpreter Lock
#187Earlier quoted context omitted.
Today's machine learning and data science students don't know how to code in those languages. They know python, and maybe java.
Don't forget R... shudders
Re: Let's Remove the Global Interpreter Lock
#188Re: Let's Remove the Global Interpreter Lock
#189Earlier quoted context omitted.
There are many cases where the objects are too big to be passed around. Python is used a huge amount in Machine learning and datascience, where being able to do parallel work on stuff already in memory would be great.
Can't this already be handled by calling out to a C/C++ or FORTRAN procedure that processes the data in multiple threads? For number crunching, Python is almost exclusively used as glue.
Re: Let's Remove the Global Interpreter Lock
#190Earlier quoted context omitted.
Python's "multiprocessing" means launching another Python interpreter in a subprocess. Each process has a full copy of the Python environment. They may share the base interpreter, but there's a separate copy of every package loaded and all data. Memory consumption is bloated and the CPU caches thrash. Launching a subprocess is expensive; it means a full interpreter launch and a recompile/reload. "Multiprocessing" is…
If CPU load is an issue, why would you be using an interpreter in the first place?
I'm not going to run your code on my server if your code uses resources so poorly that I can't run other things I want to run on my server.