[Stackless] Practical uses of stackless technology

Michael Hudson mwh at python.net
Tue Oct 24 12:33:11 CEST 2006

"Richard Tew" <richard.m.tew at gmail.com> writes:

> On 10/23/06, Carl Friedrich Bolz <cfbolz at gmx.de> wrote:
>> Being technical hacker types, we can cope with describing the ins and
>> outs of how our code works, but are less sure on the motivations for
>> stackless-style technologies as used in real-world applications  :)
>> (especially since this part of PyPy is not used for any applications
>> yet).
>> So this is where we come to you, the existing stackless community: why
>> are you interested in stackless? What benefits does it bring to you and
>> your business? (the EU always likes to hear that businesses are using
>> things  :)
> The advantage of using Python is that it allows you to write readable
> code which you can come back to at a later date and find almost as
> approachable and can still maintain because of this.  And not surprisingly
> this is something which Python is known for.
> And readability is what I think of, when I think of the primary
> benefit of using Stackless.  Through the use of tasklets and channels
> almost anything can be hidden behind a synchronous call, naturally
> extending the readability of Python by allowing a large disregard
> for techniques like callbacks and the need to otherwise use
> lots of boilerplate.  That you can just schedule functions as
> microthreads through tasklets, and have them predictably
> scheduled through cooperative multitasking fleshes this out.

This sort of thing is definitely the impression I'm getting.  Games or
simulations where you have arbitrarily many 'agents' acting in

It also seems like stackless ought to be a fit for concurrent
networking apps, but people don't seem to be seriously using stackless
for this (yet?).  I guess it's partly the desire to rely on someone
else's, e.g., HTTP code.  Though I guess EVE *is* a concurrent
networking app :)

> This is what I think of as I use Stackless every day at CCP.  The
> natural way it enhances Python to allow writing of simple and readable
> code.  And this was the reason that CCP chose Stackless.  The first
> requirement in the design of our server was that writing game logic be
> as simple as possible and we saw cooperative multitasking as the
> way to do this.  We evaluated several solutions but when we came
> across Python and the Stackless extension, to quote Hilmar (our
> CEO) "we felt we had heaven in our hands".
>> As well as the more general stackless ideas (tasklets, channels, etc) we
>> are interested in hearing about any use people are making of the tasklet
>> pickling features.
> We do not use this at CCP, and I do not use it in my own projects either.
>> It would be wonderful if we could get some nice quotable, attributable
>> snippets, but general ideas would also be very welcome.
> The quote that Hilmar, CEO of CCP gave to put on python.org was:
> "Python enabled us to create EVE Online, a massive multiplayer game,
> in record time. The EVE Online server cluster runs over 25,000
> simultaneous players in a shared space simulation, most of which is
> created in Python. The flexibilities of Python have enabled us to
> quickly improve the game experience based on player feedback," said
> Hilmar Veigar Petursson of CCP Games.
> Given our requirement for cooperative scheduling, it is not hard to
> see that this
> is as much talking about Stackless and its tasklets and channels as it is
> Python itself.
> I can ask Hilmar to give a customised version of this or something
> similar if you find it suitable?

That would be great, if it's not too much trouble.

> I also like the quote by Josh Ritter from the Stackless applications page.
> http://www.stackless.com/wiki/Applications
> "It's very important that scriptors can generate code for both the
> client and server in (relatively) anonymous functions. It's also
> critical they don't have to manage a lot of bookkeeping code for
> performance and integration. Stackless's tasklets and channels are a
> very good fit for exactly this... they have a very natural feel when
> compared to python generator functions. It's cool that something as
> mind melting as coroutines can actually make it easier for
> non-programmers to write code!!!"
> Hope this helps,

It's exactly the sort of thing we were after, yes :)


  A witty saying proves nothing.                           -- Voltaire

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list