xmlrpc idea for getting around the GIL

Aahz aahz at pythoncraft.com
Sun Nov 29 16:57:52 CET 2009


In article <4b0b07a1$0$22159$9b622d9e at news.freenet.de>,
=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=  <martin at v.loewis.de> wrote:
>
>In any case, I don't think you'll need a multi-process solution; a
>single-process multi-threading approach will do fine. Just create
>*another* thread, that runs at a low priority and is allowed to block.
>Run the Python interpreter in that thread (create multiple of these if
>you need them).  Then, use some queuing producer-consumer communication
>between the high-priority thread and the low priority thread. Have the
>high priority threads put requests into the queue, and the low priority
>thread take them from the queue, dispatching them to Python. Make sure
>you use non-blocking synchronization on the queue, or else priority
>inheritance if you can get permission to do so.

This is close to what I would recommend, but I would suggest that the
low-priority thread make calls out to an external Python process; that
way, you can have a Python worker pool of processes.  Based on what I've
seen posted over the years, I generally recommend against instantiating
multiple interpreter instances (although I've seen some success stories,
I've seen more people butting their heads against the brick wall).
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.  



More information about the Python-list mailing list