More than one interpreter per process?

Roger Binns rogerb at rogerbinns.com
Tue Dec 18 04:24:01 EST 2007


sturlamolden wrote:
> If one can have more than one interpreter in a single process, 

You can.  Have a look at mod_python and mod_wsgi which does exactly
this.  But extension modules that use the simplified GIL api don't work
with them (well, if at all).

> Most of the conversion of the current Python C API could be automated.

The biggest stumbling block is what to do when the external environment
makes a new thread and then eventually calls back into Python.  It is
hard to know which interpretter that callback should go to.

You are also asking for every extension module to have to be changed.
The vast majority are not part of the Python source tree and would also
have to support the versions before a change like this.

You would have more luck getting this sort of change into Python 3 since
that requires most extension modules to be modified a bit (eg to deal
with string and unicode issues).

But before doing that, why not show how much better your scheme would
make things.  The costs of doing it are understood, but what are the
benefits in terms of cpu consumption, memory consumption, OS
responsiveness, cache utilisation, multi-core utilisation etc.  If the
answer is 1% then that is noise.

Roger



More information about the Python-list mailing list