global interpreter lock

Michael Sparks ms at cerenity.org
Mon Aug 22 16:04:52 EDT 2005


Paul Rubin wrote:
> Mike Meyer <mwm at mired.org> writes:
>> Even simpler to program in is the model used by Erlang. It's more CSP
>> than threading, though, as it doesn't have shared memory as part of
>> the model. But if you can use the simpler model to solve your problem
>> - you probably should.
> 
> Well, ok, the Python equivalent would be wrapping every shareable
> object in its own thread, that communicates with other threads through
> Queues.  This is how some Pythonistas suggest writing practically all
> multi-threaded Python code.  It does a reasonable job of avoiding
> synchronization headaches and it's not that hard to code that way.
> 
> But I think to do it on Erlang's scale, Python needs user-level
> microthreads and not just OS threads.  

You've just described Kamaelia* BTW, except substitute micro-thread
with generator :-) (Also we call the queues outboxes and inboxes, and 
the combination of a generator in a class with inboxes and outboxes
components)
   * http://kamaelia.sf.net/

For those who really want threads as well, theres a threaded component based
class that uses Queues instead :)

Best Regards,


Michael.




More information about the Python-list mailing list