[Python-Dev] Re: marking shared-ness

gvwilson@nevex.com gvwilson@nevex.com
Thu, 20 Apr 2000 10:40:48 -0400 (EDT)


>     Chris> I think, instead of shared globals, it would make more sense to
>     Chris> have some explicit shared resource pool, which controls every
>     Chris> access via mutexes/semas/whateverweneed. 

> Skip wrote:
> Tuple space, anyone?  Check out
>     http://www.snurgle.org/~pybrenda/
> It's a Linda implementation for Python. You can find out more about
> Linda at
>     http://www.cs.yale.edu/Linda/linda.html

Linda is also the inspiration for Sun's JavaSpaces, an easier-to-use layer
on top of Jini:

    http://java.sun.com/products/javaspaces/
    http://cseng.aw.com/bookpage.taf?ISBN=0-201-30955-6

On the plus side:

1. It's much (much) easier to use than mutex, semaphore, or monitor
   models: students in my parallel programming course could start writing
   C-Linda programs after (literally) five minutes of instruction.

2. If you're willing/able to do global analysis of access patterns, its
   simplicity doesn't have a significant performance penalty.

3. (Bonus points) It integrates very well with persistence schemes.

On the minus side:

1. Some things that "ought" to be simple (e.g. barrier synchronization)
   are surprisingly difficult to get right, efficiently, in vanilla
   Linda-like systems. Some VHLL derivates (based on SETL and Lisp
   dialects) solved this in interesting ways.

2. It's different enough from hardware-inspired shared-memory + mutex
   models to inspire the same "Huh, that looks weird" reaction as
   Scheme's parentheses, or Python's indentation.  On the other hand,
   Bill Joy and company are now backing it...

Personal opinion: I've felt for 15 years that something like Linda could
be to threads and mutexes what structured loops and conditionals are to
the "goto" statement.  Were it not for the "Huh" effect, I'd recommend
hanging "Danger!" signs over threads and mutexes, and making tuple spaces
the "standard" concurrency mechanism in Python.

I'd also recommend calling the system "Carol", after Monty Python regular
Carol Cleveland.  The story is that Linda itself was named after the 70s
porn star Linda Lovelace, in response to the DoD naming its language "Ada"
after the other Lovelace...

Greg

p.s. I talk a bit about Linda, and the limitations of the vanilla
approach, in http://mitpress.mit.edu/book-home.tcl?isbn=0262231867.