[Python-Dev] Pythonic concurrency

Nick Coghlan ncoghlan at gmail.com
Tue Oct 11 12:04:07 CEST 2005


Donovan Baarda wrote:
> On Fri, 2005-10-07 at 23:54, Nick Coghlan wrote:
> [...]
> 
>>The few times I have encountered anyone saying anything resembling "threading 
>>is easy", it was because the full sentence went something like "threading is 
>>easy if you use message passing and copy-on-send or release-reference-on-send 
>>to communicate between threads, and limit the shared data structures to those 
>>required to support the messaging infrastructure". And most of the time there 
>>was an implied "compared to using semaphores and locks directly, " at the start.
> 
> 
> LOL! So threading is easy if you restrict inter-thread communication to
> message passing... and what makes multi-processing hard is your only
> inter-process communication mechanism is message passing :-)
> 
> Sounds like yet another reason to avoid threading and use processes
> instead... effort spent on threading based message passing
> implementations could instead be spent on inter-process messaging.
> 

Actually, I think it makes it worth building a decent message-passing paradigm 
(like, oh, PEP 342) that can then be scaled using backends with four different 
levels of complexity:
   - logical threading (generators)
   - physical threading (threading.Thread and Queue.Queue)
   - multiple processing
   - distributed processing

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com


More information about the Python-Dev mailing list