[dmd-concurrency] CSP: Communicating sequential processes

Sean Kelly sean at invisibleduck.org
Tue Jan 19 23:07:53 PST 2010


On Jan 19, 2010, at 10:00 PM, Robert Jacques wrote:

> Communicating sequential processes and pi calculus are one of the other major schools of message passing. There's been some interest in it, so I'm digging out and summarizing some old notes of mine. I view implementing CSP as a good use case for D's message passing architecture; i.e. one should be able to write a CSP library and have it compose gracefully with other concurrent libraries. Most of the active research in this area is being done by the University of Kent (http://www.cs.kent.ac.uk/projects/ofa/kroc/).

Thanks for all the info!

> An aside: I ran across CREW (Concurrent read, exclusive write) locks again while making this. These have always seemed perfect for D as it has both const and shared/synchronized method modifiers. I don't think there's any blockers for implementing this, so should I file a bugzilla enhancement request, so it gets onto the big long todo list?

Is what you want in core.sync.rwmutex?  You can use it as:

synchronized( mut.reader ) {}
synchronized( mut.writer ) {}

It doesn't currently allow upgrading read locks to write locks, though I think this wouldn't be difficult to add.  More importantly I suppose is that acquiring a concurrent read lock may be more expensive than you'd expect, so you really only want to use a ReadWriteMutex if the read operations take a reasonable amount of time to complete.


More information about the dmd-concurrency mailing list