-
Notifications
You must be signed in to change notification settings - Fork 6
Clarify what is a "sub-interpreter" and what is an "interpreter". #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
IMO, "subinterpreter" not a good term; generally we should aim to make all interpreters equal (though that can be a long-term goal). |
Sub-interpreters already exist, whether we like the term or not. Why not leave them working as they do now, and enable multiple interpreters? |
As far as I can see, "sub-interpreter" and "interpeter" are basically interchangeable terms at this point. See e.g. the first two sentences in the Py_NewInterpreter docs.
|
The problem with that approach is that involves a lot of moving stuff from Until multiple interpreters can run in parallel, moving global state into |
I doubt it – you'd need to make a per- What exactly do you mean by allowing subinterpreters to work as they currently do? |
All sub-interpreters share the same heap (even though they can see different parts of it) and share the GIL. |
So, to clarify, under your proposal with multiple |
Doesn't sharing a heap between interpreters require synchronization for the cycle GC? |
My main point is that without clearer naming, it is impossible to discuss these alternatives without a lot confusion. |
OK. Here's my take.
As for an earlier question, I don't think that moving stuff from |
The key detail is that there is a "main" interpreter:
We have been calling all other interpreters in the runtime "subinterpreters". FWIW, in the context of PEP 554, we start at the main interpreter. Each new interpreter then effectively ends up as a node in an implicit tree relative to "parent" interpreter under which the new one was created. However, that isn't fundamental at the C level. |
FYI, the C-API docs have a paragraph explaining the distinction (thanks to @nanjekyejoannah). @markshannon, do you think it would help to have more detail there? (IMHO, there isn't much more to say that we say there.) |
PEP 554 is entitled "Multiple Interpreters in the Stdlib", yet the term "subinterpreters" is used throughout this repo.
There is the additional confusion of the C struct names.
It seems to me that the C struct
PyInterpreterState
corresponds to the sub-interpreter and that the C struct_PyRuntimeState
corresponds to the interpreter.Confusion about which is which makes the goals of this project unclear, and I fear may have resulted in some unnecessary work, as data structures are moved to
PyInterpreterState
that could more easily, and with less impact, been moved to (or left in)_PyRuntimeState
.The text was updated successfully, but these errors were encountered: