◐ Shell
reader mode source ↗
Skip to content

gh-99113: A Per-Interpreter GIL!#99114

Closed
ericsnowcurrently wants to merge 318 commits into
python:mainfrom
ericsnowcurrently:per-interpreter-gil-new
Closed

gh-99113: A Per-Interpreter GIL!#99114
ericsnowcurrently wants to merge 318 commits into
python:mainfrom
ericsnowcurrently:per-interpreter-gil-new

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Nov 5, 2022

Copy link
Copy Markdown
Member

I've split up this PR:

That last one is effectively the superseder of this one.



This is the culmination of PEP 684 (and of my 8-year long multi-core Python project)!

Each subinterpreter may now be created with its own GIL (via Py_NewInterpreterFromConfig()). If not so configured then the interpreter will share with the main interpreter--the status quo since the subinterpreters were added decades ago. The main interpreter always has its own GIL and subinterpreters from Py_NewInterpreter() will always share with the main interpreter.


This is essentially the correct implementation but it may change here and there before we've reached the end.

We won't merge this until:

  • PEP 684 is accepted (if it is accepted), which might be up to a few months due to the changing steering council
  • interpreters have been sufficiently isolated (see my checklist)
  • we have been extra careful about testing this

I'm merging in other branches that this one relies on, but those will wash out as the other PRs get merged. In the meantime, you can see the actual changes here: https://github.com/python/cpython/compare/main...ericsnowcurrently:per-interpreter-gil-new-bare?expand=1.

259 hidden items Load more…
@gvanrossum

Copy link
Copy Markdown
Member

318 commits, 114 files, 23 reviewers… How are we going to do this?

@arhadthedev

arhadthedev commented May 5, 2023

Copy link
Copy Markdown
Member

318 commits, 114 files, 23 reviewers…

We can create a separate PR that just defines a no-op slot Py_mod_multiple_interpreters/Py_MOD_* and adds {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED} to the modules.

Thanks to it, this PR will become a much smaller follow-up.

@AlexWaygood

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood removed request for https://github.com/orgs/python/teams/windows-team, corona10, pablogsal, erlend-aasland, Fidget-Spinner, isidentical, kumaraditya303 and AlexWaygood

Not sure how that happened — I only meant to remove my own request for review...

@erlend-aasland

Copy link
Copy Markdown
Contributor

318 commits, 114 files, 23 reviewers… How are we going to do this?

Actually, most of the changed files are repetitive, trivial updates of various extension module's PyModuleDef structs.

@arhadthedev

Copy link
Copy Markdown
Member

most of the changed files are repetitive, trivial updates of various extension module's PyModuleDef structs

Their repetitiveness takes attention from other parts of the diff and requires to constantly scroll through all of them for each inter-file comparison in other parts of the PR. It makes the analysis harder. That's why I proposed to move them out into a separate PR, merge it and update this PR.

@zooba

zooba commented May 5, 2023

Copy link
Copy Markdown
Member

I quickly went through and marked all those files as "Viewed", then used the File Filter drop down to hide viewed files. So I've only got 7 files left with non-trivial changes, one of which is the NEWS entry.

image

Looks like the "viewed" state is remembered, but the filter needs to be set each time I go back in.

@ericsnowcurrently

Copy link
Copy Markdown
Member Author

I had seriously considered splitting this PR up yesterday. I should have listened to myself. 🙂 I'm going to split it up.

@ericsnowcurrently

Copy link
Copy Markdown
Member Author

I've noted the new PRs above in the PR summary.

ericsnowcurrently added a commit that referenced this pull request May 5, 2023
…04148)

I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.
jbower-fb pushed a commit to jbower-fb/cpython that referenced this pull request May 8, 2023
…pythongh-104148)

I'll be adding a value to indicate support for per-interpreter GIL in pythongh-99114.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants