[Python-ideas] PEP 554: Stdlib Module to Support Multiple Interpreters in Python Code
ncoghlan at gmail.com
Wed Sep 13 18:58:38 EDT 2017
On 14 September 2017 at 08:46, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 13 September 2017 at 14:10, Nathaniel Smith <njs at pobox.com> wrote:
>> Subinterpreters are basically an attempt to reimplement the OS's
>> process isolation in user-space, right?
> Not really, they're more an attempt to make something resembling
> Rust's memory model available to Python programs - having the default
> behaviour be "memory is not shared", but having the choice to share
> when you want to be entirely an application level decision, without
> getting into the kind of complexity needed to deliberately break
> operating system level process isolation.
I should also clarify: *Eric* still has hopes of sharing actual
objects between subinterpreters without copying them.
*I* think that's a forlorn hope, and expect that communicating between
subinterpreters is going to end up looking an awful lot like
communicating between subprocesses via shared memory.
The trade-off between the two models will then be that one still just
looks like a single process from the point of view of the outside
world, and hence doesn't place any extra demands on the underlying OS
beyond those required to run CPython with a single interpreter, while
the other gives much stricter isolation (including isolating C globals
in extension modules), but also demands much more from the OS when it
comes to its IPC capabilities.
The security risk profiles of the two approaches will also be quite
different, since using subinterpreters won't require deliberately
poking holes in the process isolation that operating systems give you
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas