[Python-Dev] Pythonic concurrency

Jim Fulton jim at zope.com
Thu Sep 29 20:35:51 CEST 2005


Michael Hudson wrote:
> Bruce Eckel <BruceEckel-Python3234 at mailblocks.com> writes:
> 
> 
>>I'd like to restart this discussion; I didn't mean to put forth active
>>objects as "the" solution, only that it seems to be one of the better,
>>more OO solutions that I've seen so far.
>>
>>What I'd really like to figure out is the "pythonic" solution for
>>concurrency. Guido and I got as far as agreeing that it wasn't
>>threads.
>>
>>Here are my own criteria for what such a solution would look like:
> 
> 
> Just because I've been mentioning it everywhere else since I read it,
> have you seen this paper:
> 
> http://research.microsoft.com/Users/simonpj/papers/stm/
> 
> ?  I don't know how applicable it would be to Python but it's well
> worth the time it takes to read.

I haven't read more than the abstract and the responses to the paper
here, but I think I have the gist. (I look forward to reading it later.)

I'll note that we have experience with something less rigorous
than but otherwise similar to this with ZODB.  We often have tens of
processes working on the same data, synchronizing through a common
object store.  Each process executes transactions which are written
without any threading code at all.  Processes synchronize through
transaction commits.  This model has worked very well for Zope,
at least as long as conflicts can be kept to a minimum. :)

The ZODB approach is less rigorous as it only works when your processes
operate soley on database objects, but it provides a useful example,
I think, of applying this model in Python and it probably covers a
reasonably large set of interesting applications.  There are
hundreds (possibly thousands) of programmers who have used this technique
in Zope, probably without even realizing that they were doing concurrent programming.

J2EE systems use a similar approach.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Python-Dev mailing list