[Stackless] rough PyCon'07 draft; feedback wanted
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
- 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
= = = = = which is like = = = =
schedule() (no equivalent)
There's also "run()" which is mostly a wrapper
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
Producer / consumer 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
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
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
but it blocks. Can I fix it?
I would like the Stackless code to look like ...
Modify the asyncore stackless_http_client
Make a file-like reader
add timeout to scheduler
normal Python code using socket
Stackless Python code using stacklesssocket
Monkey-patching affect other socket code!
Probably another slide here
Conclusion / direction / future
dalke at dalkescientific.com
Stackless mailing list
Stackless at stackless.com
More information about the Stackless