[Stackless] Anyone want to review my presentation for the Atlanta Python meetup group?

Andrew Francis andrewfr_ice at yahoo.com
Thu Mar 20 16:34:27 CET 2008


Hi Richard:

>If you have any thoughts about how to improve the
>presentation, please let me know.  There are notes
for >most pages which give a little more context to
what I >will be talking about for each.  I am not
likely to
>do a rewrite at this stage, so this is regarding
>improving the
>existing slides.

>If you understand the limitations of generator
>coroutines, I would especially appreciate a review of
>that section.

Once again, I deeply appreciate your help improving my
talk.

I do some comparisons at the end of "Adventures." You
may not have seen the latest and greatest version.

When I use generators, I use them for iteration rather
than "co-routines." Since I have Stackless, I haven't
really explored the latest features in generators
(like send()). So I don't consider myself an expert. 

As it has been explained in this mailing list, the
main limitation to the generator as coroutine approach
comes from when you have to nest generators

I have pestered the Twisted gang with these questions.
In particular, JP Calderone has been really gracious
in answering my questions and providing examples.

Using Twisted as an example, you can't do this:

@inlineCallback
def process(self):
    result = yield client.getPage()
    return result

Note, process() is a method for HTTP requestHandler
objects. Under the hood, @inclineCallback uses a
generator. 

This is a generator within a generator - the language
doesn't allow this - although this is the most natural
thing a progammer wants to do.

With some glue like Christopher Armstrong's blockOn,
you should be able to do:

(see http://twistedmatrix.com/trac/changeset/10072)

def process(self):
    result = self.blockOn(client.getPage())
    return result

In turn, if a getPage() implementation needed to
block, a tasklet/channel would have no problem
handling this either.

In an actual situation, I think where a generator
approach would really melt down is when one deals with
complex message exchange patterns - WS-BPEL/SOA allow
for weird sequences (i.e., asynchronous SOAP calls) a
normal web server application would never see.

That said, look at Christopher Armstrong's work with
deferredGenerators and inlineCallbacks. After talking
with Glyph and Itamar (and the rest of the gang), I
think the key to true Stackless/Twisted integration,
is some form of deferredChannel. I am still munching
on the concept.

There is a subtle argument in "Adventures" - that is
Twisted and Stackless's concurrency models are more
similar than different.

As for the rest of your papr - it is simple - I like
it. From the feedback I received for my own talk and
my experiences, here are some thoughts.

1) Try to explain why Stackless's model is easier than
say POSIX.

Regrettably I took out examples of how stuff like
mutual exclusion and non-preemption make your life
easier.

2) Show something that Stackless can do easily and
other languages cannot do - pickling of execution
state.

When I showed folks in private serialisation of
execution state - they were impressed even though I
thought my example was crude (at least to me).

3) [this is iffy] Try to explain Stackless in terms of
operating systems 101 concepts. Unfortunately, in my
paper this has the somewhat negative effect of showing
how deadlock occurs. 

4) Mention performance. People care about performance.

5) Mention that Stackless does need some batteries
included. However I think showing all the machinery to
make tasklets do simple things like sleep() or perform
network I/O detracts from Stackless's strength. Great
for the implementers. A turnoff for a newbie.

That was the main concern I had with Dalke's paper and
my own - too much is dedicated to showing stuff a
regular thread solution does easily. In turn, I use
Twisted to keep what a former colleague called
"apparatus" or what the Japanese call non-value-added
activities to a minimum.

Cheers,
Andrew




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping




More information about the Stackless mailing list