GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
Posted Aug 3, 2023 7:57 UTC (Thu) by roc (subscriber, #30627)Parent article: GIL removal and the Faster CPython project
It would be helpful if the motivation section for PEP 703 carefully explained why in each case PEP 684 with one interpreter per thread would not mitigate the issue, or could not be enhanced to mitigate the issue. There would still be inter-interpreter communication overhead, but that seems like a much easier problem to solve than PEP 703. E.g. maybe you could build an object migration API that exposes a inter-interpreter object queue, where pushing an object into the queue consumes the object reference. If the object refcount is 1 you can scan the object subgraph, and if any inner objects have refcounts > 1 you copy them or immortalize them, then hand off ownership of the entire object graph to the destination interpreter.
Posted Aug 3, 2023 9:07 UTC (Thu)
by mb (subscriber, #50428)
[Link] (2 responses)
There already are Python interpreters without a GIL, like Jython and pypy-stm.
Posted Aug 3, 2023 9:35 UTC (Thu)
by roc (subscriber, #30627)
[Link] (1 responses)
They're not exactly mainstream though.
Posted Aug 18, 2023 12:54 UTC (Fri)
by sammythesnake (guest, #17693)
[Link]
It's a shame, though - STM in particular was a pretty cool *concept*, even if making it work kinda wants hypothetical hardware support :-P
Posted Aug 3, 2023 9:39 UTC (Thu)
by roc (subscriber, #30627)
[Link]
Posted Aug 3, 2023 21:18 UTC (Thu)
by bluss (guest, #47454)
[Link] (1 responses)
Posted Aug 4, 2023 9:01 UTC (Fri)
by zorro (subscriber, #45643)
[Link]
I'm sure there is some task and thread management overhead under the hood when using this .NET feature, but it does not sound as heavyweight as a Python sub-interpreter (I could be wrong about that)
Posted Aug 5, 2023 9:06 UTC (Sat)
by ssmith32 (subscriber, #72404)
[Link] (1 responses)
- ensure existing python code works the same
- ensure Faster Python (single thread performance) isn't impacted long term. Most notably, by the time no-gil is the default.
So.. you shouldn't see single thread performance go down, and you'll only get into race-condition territory if you actively decide to change how you write your python code.
Posted Aug 8, 2023 18:12 UTC (Tue)
by roc (subscriber, #30627)
[Link]
You could make the entire JIT state per-thread, I suppose, though that will be slow since you'll have an extra layer of indirection to get to your PICs etc. Otherwise you'll be synchronizing on it some way or another.
You'll definitely have unavoidable overheads making sure that Python object state (e.g. refcounts) isn't corrupted by data races. Sure, do deferred refcounting etc, but you need extra machinery that at some point you'll have to pay for. Also the complexity of the Python implementation is going to soar.
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
GIL removal and the Faster CPython project
