Tuesday, February 19, 2008

Greenlet Python is concurrently alive and kicking


As I mentioned before I am a big fan of the Python programming language, and for good reasons, in particular support for thousands of simultaneous lightweight threads (tasklets) with Stackless Python (which requires a modified Python interpreter).

Greenlet and Eventlet
What I recently discovered was Greenlets. It is a spinn-off library from Stackless Python but as opposed to Stackless it is supported by the standard Python interpreter. There are also some interesting additional libraries based on Greenlets, e.g. the Eventlet networking library.

(Hm, maybe using Greenlets with Parallel Python could be a thought)

Concurrency seems to be getting increasingly more attention, and it is great to see that Python is not falling behind, actually far from it. Maybe Python can be used to solve some of the challenges in concurrency.

1 comment:

stedi said...

nice post. Here is some further information. Basicly, greenlets and stackless tasklets are equivalent and the stackless interface can be implemented with greenlets (minus pickling). There are two killer features where stackless python stands out: 1. tasklets can be pickled and 2. switching is much faster (anecdotical evidence: 10 times faster).

One misconception about both is that this has somehow something to do with parallel computing: it has not.