Kill GIL

Adrian Casey news at outbacklinux.com
Tue Feb 15 06:52:38 EST 2005


Aahz wrote:

> In article <mailman.2502.1108343142.22381.python-list at python.org>,
> Frans Englich  <frans.englich at telia.com> wrote:
>>
>>Personally I need a solution which touches this discussion. I need to run
>>multiple processes, which I communicate with via stdin/out,
>>simultaneously, and my plan was to do this with threads. Any favorite
>>document pointers, common traps, or something else which could be good to
>>know?
> 
> Threads and forks tend to be problematic.  This is one case I'd recommend
> against threads.

Multiple threads interacting with stdin/stdout?  I've done it with 2 queues. 
One for feeding the threads input and one for them to use for output.  In
fact, using queues takes care of the serialization problems generally
associated with many threads trying to access a single resource (e.g.
stdout).  Python Queues are thread-safe so you don't have to worry about
such issues.



More information about the Python-list mailing list