[Stackless] rough PyCon'07 draft; feedback wanted

Andrew Dalke dalke at dalkescientific.com
Wed Feb 14 08:47:38 CET 2007


On Feb 13, 2007, at 2:20 PM, Christian Tismer wrote:
> The talks are pretty disjoint. But if the pickling is not touched
> at all, I can mention it and give a small, but impressing
> example (pickle in the middle of a recursion and wake up
> in this recursion on another machine)

I've done a preliminary pass at coming up with slides.  I've
about 45 which is the right range for a 40 minute talk. I'm
dropping:
   - file sniffing
   - alternatives to the spam&eggs example

and I've decided to keep the factorial example because it shows
something you'ld never do with a thread alternative.

I've probably missed a couple of slides in my estimate which
means I've no more space to talk about pickling, especially
as I've not come up with an example I want to talk about.

But I really would like it if someone volunteered to give
a lightning talk pointing out pickling and migration of
the process across hosts!


Here's my slide outline.


Stackless is Python

simple program, print results

===

The three I'll talk about are:
   tasklets, channels, cooperative multitasking

More specifically I'll talk about
   Stackless                     Threads
   = = = = =     which is like   = = = =
   tasklet                       thread
   channel                       Queue(1)
       .send(x)                     .put(x)
       .receive(x)                  .receive()

   schedule()                    (no equivalent)

There's also "run()" which is mostly a wrapper
around "schedule()"
===

Stackless adds new parallelism features to Python

rewrite above simple progam in Stackless

===

Show picture of program with main tasklet stack, stack for new
tasklet, assign, etc.  Can I animate this?

===

Start three tasklets, show system animation.


===

tasklet yielding control

===

print 3 columns, no scheduling

===

round-robin scheduling w/ 3 columns

===

Create a channel / send & receive

graphically?

===

Producer / consumer example

===

Factorial example

===

Those were toys.  Here's something new.

Example of normal SAX processing

===

Picture of the layers

===

Want to switch this to a pull parser
Example API

===

Here's the code

===

It'll take 2 slides

===

channels implement the iter protocol

===

Timing comparisons for the number of start elements

===

Blocking - what do do

If you control the code and it's compute bound
   add schedule calls

===

Don't control, or uses a blocking system call

Can thread

===

Will need another slide for this.

===

Sleep blocks, but can do better.
   fried spam and eggs example
    show the API I want

===

   Can use threads but there are other ways
   Example with a busy-wait sleep for each tasklet

===

   Example with a shared busy-wait sleep scheduler

===

   A new "run" command

===

   How to tell when to exit

===

   Modified sleep scheduler that can sleep for real.

===

   Network I/O / asyncore

Example from asyncore docs for http fetch

===

Compare to normal code

===

The problem: hash of reverse document
Normal code

but it blocks.  Can I fix it?

===

I would like the Stackless code to look like ...

===

new scheduler

===

new "run_all"

===

Modify the asyncore stackless_http_client

===

Make a file-like reader

===

Compare outputs

===

add timeout to scheduler

===

stacklesssocket.py

===

normal Python code using socket

===

Stackless Python code using stacklesssocket

===

Monkey-patching

===

Monkey-patching affect other socket code!

===

Probably another slide here

===

Conclusion / direction / future




				Andrew
				dalke at dalkescientific.com



_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list