[Stackless] Multi-CPU Actor Based Python

Timothy Baldridge tbaldridge at gmail.com
Tue Nov 18 22:41:36 CET 2008

> Stackless essentially does that in the form of tasklets using channels.
> Kamaelia also does something similar, but uses lists for generators,
> Queue.Queue's for threads, the os.pipes for (pickled) objects between
> processes. (kamaelia works with standard cpython)

The issue with Stackless is that you are still limited by the GIL.
Therefore you can never use more than 100% of one CPU. You can
pickle/unpickle messages and pass them via pipes or shared memory, but
that takes time. Simply copying a pointer would be much faster.

> Now, the principles of shared nothing and message passing can be implemented
> in Python and non-functional languages, and you can get very high scalability
> (cf eve online in Stackless for example), but your model won't be *identical*
> to Erlang, because it can't be - Python is fundamentally built on mutable
> types, whereas Erlang is fundamentally functional and built on immutable
> types.

But that's the issue, even CCP has had issues scaling EVE. EVE is
implemented in a way that each star system is handled by a single
thread. This is fine if you have 10000 star systems and 100 CPUs. But
the problems come when 1000 players start to duke it out in one star
system. The single CPU cannot handle this pressure. Systems like Jita
have rather poor performance ingame. Recently CCP fixed some IO
performance issues, and this helped.

> The flipside, which the Reia people are doing is to try and implement a
> python-like syntax on top of the Erlang VM, which I find particularly
> interesting - http://wiki.reia-lang.org/

That could work, but you're limited by the Erlang VM which in turn is
limited by some of the functional programming semantics (like
immutable variables).

More information about the Stackless mailing list