Python subinterpreters with separate GILs
Cameron Simpson
cs at cskk.id.au
Wed Feb 10 23:22:35 EST 2021
On 10Feb2021 21:51, James Lu <jamtlu at gmail.com> wrote:
>Directly removing the Global Interpreter Lock (GIL) would break a lot
>of libraries that implicitly assume it is there. What if Python had
>"realms" that each had separate GILs?
>
>The "realms" (not sure if "subinterpreter" is the correct term here)
>could share objects.
If realms can shared objects then they'd need the same GIL, because
otherwise objects are not protected from concurrency via different
realms. CPython code and C code, unless it has itself released the GIL,
assumes it is the exclusive user of objects - that's what the GIL means.
Separate GILs would mean different realms' GIL-holding threads could run
against a shared object at the same time.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list