3 ms·
What in your view are the weaknesses of subinterpreters compared to multiprocessing?
by lsorber 7y ago
What in your view are the weaknesses of subinterpreters compared to multiprocessing?
- pas 7y agoIf they live in the same process (address space), then it's a lot harder to correctly manage concurrent memory access (at both low level and high). It's not a theoretical problem, just a very likely pragmatic observation. (Meaning, we'll see bugs in both the interpreter and the code using this feature.) Plus if one of the threads crashes, the whole process aborts. (Sure, the interpreter can handle a lot of faults gracefully, but not all.)
- loeg 7y agoThe main weakness is the one pas described in the sibling comment. Historically, Python C modules, inside and outside stdlib, have more or less safely been able to assume there was one global interpreter. This means they may have global state (apparently even some stdlib C libraries assume this). With multiple interpreters in the same process address space, any global state in C modules conflicts. I'm not claiming any originality here — the author of the article recognizes this problem and describes it, starting with: > Because CPython has been implemented with a single interpreter for so long, many parts of the code base use the “Runtime State” instead of the “Interpreter State”, so if PEP554 were to be merged in it’s current form there would still be many issues.