Embedding: many interpreters OR one interpreter with many thread states ?

flyingfred0 flyingfred0 at gmail.com
Fri Jun 10 04:25:34 CEST 2005


Of course, with multiple threads in one process, it's important to know 
about the dreaded global interpreter lock (GIL) -- 
http://docs.python.org/api/threads.html

With one instance of the interpreter, only one Python thread will be 
running at a time, no matter how many CPUs you have in the system.


Greg Ewing wrote:
> adsheehan at eircom.net wrote:
> 
>> - creating many sub-interpreters (Py_NewInterpreter) with a thread
>> state each
>>
>> Or
>>
>> - creating one interpreter with many thread states (PyThreadState_New)
> 
> 
> My understanding is that using multiple interpeters isn't
> really supported properly, despite there being apparent
> support in the API. So I suggest using a single interpeter
> with multiple threads.
> 



More information about the Python-list mailing list