[Python-ideas] Fwd: In-process interpreters
swapnil.st at gmail.com
Wed Nov 17 15:36:47 CET 2010
> Em Wed, 17 Nov 2010 13:56:43 +0530
> Swapnil Talekar <swapnil.st at gmail.com> escreveu:
> > We need to run multiple interpreters in-process. Which means we need
> > to create completely independent environments for each interpreter
> > using some very dirty hack. Since Python inherently does not support
> > this. Python threads( created using python's threading module ) are
> > not of much help because of the GIL.
> > For this purpose the solution we have adopted is moving all the
> > mutable python globals to heap.
> What about using multiple processes? You could use pipes to exchange
> information between them.
As stated in the question, this is not possible for OSes like VxWorks (which
is not rare on embedded platforms). Also there could be other constraints
like the software architecture of the given system which make having the
embedded interpreter in-process, more useful. Exchanging messages with
separate interpreter process is slower. Also, the embedding process will
have to create and expose a whole new interface which can be used by
external processes. While if the interpreter is in-process, then its just a
matter adding the services of embedding process as C-extensions to Python.
One function call is all you need.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas