Help me use my Dual Core CPU!

Paul Rubin http
Sun Sep 17 03:55:09 EDT 2006


"Ramon Diaz-Uriarte" <rdiaz02 at gmail.com> writes:
> You might also want to check
> http://www.lindaspaces.com/products/NWS_overview.html
> by the guys who "invented" Linda.

Cool, I guess.

> (The Oz language/Mozart system is a good example of a different and
> very neat approach to concurrency; somewhat similar Python solutions
> can be found at Kamaelia and Candygram. Links and other stuff at:

I looked at these.  Oz/Mozart is a whole nother language, worth
examining for its ideas, but the implementation is quite slow.
Kamaelia doesn't attempt concurrency at all.  Its main idea is to use
generators to simulate microthreads.  Candygram is a module that lets
you write code in Python that's sort of like Erlang code, but it uses
OS threads for the equivalent of Erlang processes.  That misses the
point of Erlang pretty badly, which is that processes are extremely
lightweight (i.e. normally they are microthreads) so you can have
millions of them active simultaneously (e.g. one for each active
telephone connected to a big phone switch).  

Right now I want to check out GHCI (the Glasgow Haskell compiler),
which may be the closest thing to a "winner":

  - very advanced language, even higher level than Python, once described
    by somebody as "what Python should have become"
  - native code compilation
  - lock-free concurrency using software transactional memory (STM)

The GHCI concurrency stuff is not yet really complete (e.g. the GC
still stops the world) but there is already a good speedup with
multiple processors, and the STM approach experimentally outperforms
the usual locking approach, in addition to being much less bug-prone:

  http://lambda-the-ultimate.org/node/463
  http://research.microsoft.com/users/simonpj/papers/stm/

This approach might also be of some use in PyPy.



More information about the Python-list mailing list