6 ms·
Does it include a concurrent garbage collector? And does it solve the infamous GIL (global interpreter lock) problem?
by amelius 6y ago
Does it include a concurrent garbage collector?
And does it solve the infamous GIL (global interpreter lock) problem?
- corytheboyd 6y agoI’m genuinely curious why people want to work around the GIL in languages like Python and Ruby. I very much do not want my simple interpreted language to inherit the complexity of true concurrency. Why not just use a different language?
- afarrell 6y agoIf a company has 200+ developers already working on a 10-year-old codebase in the language, then the word "just" has a lot of heavy lifting to do in that question.
- duckerude 6y agoThe GIL doesn't really let you escape the horrors of concurrency, at least in CPython. Threads can't execute at the same time, but they can interleave in inconvenient ways.
- pansa2 6y ago> Why not just use a different language? I’ve asked myself this question (in a different context) and have concluded that, in general, developers are incredibly resistant to learning and using new languages. For example: if they weren’t, then server-side JavaScript would never have become popular.
- coldtea 6y ago>I’ve asked myself this question (in a different context) and have concluded that, in general, developers are incredibly resistant to learning and using new languages. You make it sound like a personal psychological failing. In real life, using the same language has business benefits: re-use of the same libraries, no duplicated business logic that needs to be used on both client/server, no need for training to the new language, no need for mental context switch due to the language change when working on the client or server part (aside from the essential domain knowledge of client vs server), less/common tooling infrastructure, and so on...
- cat199 6y agothis is a false dichotomy - witness the numerous parallel lisps (and schemes, etc)
- glandium 6y agoI suspect an interpreter that "solves" the GIL problem will break tons of modules that currently only work in concurrent contexts because the GIL exists.
- Phrodo_00 6y agoJython and IronPython don't have a GIL so you can see the effect there (it's not as bad as I thought it would be)
- Jasper_ 6y agoOK, I'll bite: how? They need some form of locking around Python objects accessed from multiple threads, since Python has no ownership model. Do they add a lock around each individual object?
- tyingq 6y agoHere's the detail for Jython: https://jython.readthedocs.io/en/latest/Concurrency/ https://jython.readthedocs.io/en/latest/Concurrency/ Skip down to "thread safety"
- ris 6y ago> They need some form of locking around Python objects accessed from multiple threads, since Python has no ownership model. "Ownership models" are not a given. C++ has no "ownership model" and it doesn't lock around objects. Multi-threading users are just given the synchronization primitives and are expected to manage their own solutions. The same is true in Python: https://docs.python.org/3/library/threading.html#lock-objects https://docs.python.org/3/library/threading.html#lock-object... - in fact, if you're using objects simultaneously from multiple threads without using some sort of locking scheme, you're probably already in trouble... The main thing that's keeping the GIL around is the reference-counting garbage collector. If your python implementation uses its own GC mechanism, it doesn't have this problem.
- sitkack 6y ago