On Jun 16, 2008, at 9:14 AM, Jeff Senn wrote:

One quick (perhaps barely relevant) clarification:
Simon mentions "spawning multiple Python interpreters through the C/ Python API"

Even if you use the C API to create multiple interpreters in the same
processes (but in different threads), you will STILL be at odds with the GIL.

Hm... so I was curious and had a look at the interpreter code. I have to slightly take-back that statement. It appears that there might be a way to
spawn different interpreters in the same process and avoid the GIL.

If you can avoid python calling PyEval_InitThreads(), the GIL will not
be initialized or used.  So if you are very careful to use no *python*
code that causes threading to be enabled, you might get away with
non-interlocked python interpreters within the
same process but different threads.

Though I think this would be considered a hack!  (i.e. I'm not sure that
it is safe, possible, and supported)



The GIL is held in a static variable of the interpreter code (Python/ ceval.c) so you really do need to arrange for separate PROCESSES. (Separate static spaces
for the Python libraries).

It sounds like you are running separate processes and are good...


_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to