Archive for October, 2009

A Survey of Stackless Python First Edition

October 14, 2009

Hi Folks:

On September 30th, 2009 I gave a talk entitled A Survey of Stackless Python to the Montreal Python Group. I thank the Montreal Python Group for having me. And it is always a pleasure to talk about Stackless Python. The talk was well received despite hiccups. I am sure I will cringe when I watch the video. As a teenager, I cringed watching my performance on a TV game show (even though my team won). I believe I fumbled the part on channel preferences execution and response times. As well as pronouncing Gregorio’s name. I kept on thinking ‘Grogono’ (A computer science professor at Concordia University). I am sure there are more gaffs.

I am tempted to say that the slides are better than the video.

A number of cool talks inspired “Survey”: Joe Gregorio’s (Lack of) Design Patterns in Python, David Beazley’s A Curious Course on Coroutines and Robert Pike’s Advanced Topics in Programming Languages: Concurrency and Message Passing in Newsqueak. Also at the time, I had design patterns on my mind as a part of reading Bruce Eckel’s work in progress Python 3 Idioms and Design Patterns. One of my favourite computer science courses was Software Design Patterns with Dwight Deugo.

What I liked about the three talks is the way they interconnect. Towards the end of his really informative talk, David Beazley raises some legitimate questions and comments: “Is it really worth it to write your own multi-tasker?” and “Threads are a well understood model.” With Gregorio, the answer is “well the language should incorporate the mult-tasker design pattern as a feature.” And Pike: “threads are low level” and “(channels as a part of) CSP, is a well understood model.”

I feel the cumulation of the ideas in these talks provide the framework for discussing Stackless Python and other concurrency frameworks in a more systematic fashion. Essentially Stackless Python provides a powerful built-in design pattern : The Active Object. And the relevantly easy to implement but lesser known Half-Sync Half-Async pattern gives the Stackless Programmer (and his or her choice of asynchronous networking package) a best of both worlds between synchronous and asynchronous concurrency models. This is a major theme of the talk.

I know I am bad on following up on blogs and talks. However in the weeks to come, I will be posting a new version of the talk. I want to clarify some facts – i.e., memory usage and a tasklet’s state machine (there is a little more to it). I want to provide a benchmarks between say Stackless Python and a generator based solution. I want to include a section on pickling. I want to tie all the networking techniques together through the use of a small web server (I would like to see what a Newsqueak web server looks like). To provide context, I will discuss about what got me into the wonderful world of Stackless Python (Service Oriented Architectures). Finally, I want to do some learning (then again, I am always learning something new with Stackless) in the form of seeing how easy (or difficult) it is to add new language features via the future of Stackless, PyPy.