python concurrency proposal

Corey Coughlin corey.coughlin at comcast.net
Tue Jan 3 23:12:50 EST 2006


Hey, some responses, let's see...

Peter Tillotson wrote:
> I'd really like to see a concurrency system come into python based on 
> theories such as Communicating Sequential Processes (CSP) or its 
> derivatives lambda or pi calculus. These provide an analytic framework 
> for developing multi thread / process apps. CSP like concurrency is one 
> of the hidden gems in the Java Tiger release (java.util.concurrency). 
> The advantages of the analytic framework is that they minimise livelock, 
> deadlock and facilitate debugging.

Yes, a CSP-like system would be kind of nice.  Of course, to really pull 
it off, you'd probably need some kind of primitive to represent a simple 
process.  Which is kind of what I'm proposing.  It's kind of a primitive 
version, but an object to easily represent processes and communication 
channels would be a big help, I'd imagine.  Once a primitive is in 
place, I believe it would be fairly easy to build up a full set of 
CSP-ish primitives to help assemble full systems.

> I'm no expert on the theory but i've developed under these frameworks 
> and found them a more reliable way of developing distributed agent systems.
> 
> You may also be interested in looking at 
> http://sourceforge.net/projects/pympi

Ah yes, pympi, that's good stuff.  It does suggest that I might need to 
add blocking and non-blocking version of send and receive, there might 
be a need for that.  Especially the non-blocking receive, that looks 
very handy.  And maybe a .status for polling the status of running jobs. 
    It does go a lot further than I do with this proposal, it adds all 
that stuff for collecting the jobs, running them as a group, gathering 
results, and so on.  This proposal could probably use an extra library 
to provide a bunch of those type of operations, but I wanted to start a 
little bit small here with just the proposal of a process primitive. 
That seems like it would be a good first step.  Of course, what I'm 
really hoping for is that at some point you could do something like this:

import mpi

pardef vecadd(self, mpi.mpiproc, ...)

and so on.  I'm not really all that concerned about the communication 
channels and process distributions work, I suspect that many people will 
want to try different methods like MPI, or the standard pthread wrapper 
with some kind of standard queue communications channel, or pyro, maybe 
even Kamaelia.  I'm just proposing the primitive for it.  So, if there's 
anything else you'd like to see it work like, be sure to let me know. 
Thanks for the input!

    ----- Corey



More information about the Python-list mailing list