Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Introduction to Concurrent Programming with Stackless Python (grant-olson.net)
57 points by albertzeyer on June 23, 2013 | hide | past | favorite | 11 comments


Note that while Stackless Python makes coroutines and similar things easy, it offers more: You can serialize all the runtime elements like the stack trace and that data is platform independent. That gives you very nice possibilities, like moving some thread over to a different machine. Or serialize to disk and resume at some later time - maybe after a reboot or after some edit of the code. That is also great for debugging and inspection.

It makes Python much more dynamic - and somewhat more similar to Smalltalk.


This article is relatively old (2006) and pretty outdated. I can't find the link now, but I remember reading that Stackless is no longer recommended, because modern Python can now provide the same functionality (using generators).

If you can stick with regular Python then I highly recommend it; Stackless requires a different Python binary with is a PITA for deployment/production.


I understand that generators allow concurrency, but not parallelism (you can't have more than one generator actually running at the same time, on different cores).

If Stackless doesn't support parallelism either (I have no clue), then yeah, it doesn't make much sense to use it.


Yep, yep. Stackless doesn't support parallelism either, it only enables cooperative multitasking.


> To take advantage of both multi-core machines and distributed programming, concurrency quickly becomes the de-facto standard way of doing things.

Parallelism is the way to achieve better compute performance. I assume stackless still has a GIL and can only take advantage of one core? Does it provide any inter-process communication that would help with parallelism?


Has anyone used Stackless Python in production yet?


Several years ago I was using it in production at a major CDN. I would assume they still use it.


According to Wikipedia, at least the Eve Online MMO uses it quite heavily, as well as an IronPython Mail client thingy. For whatever that's worth.


As a programmer on the EVE team for the last 7 years, I would not recommend it at this point in time. Stackless is a fork of CPython, maintained by a small number of people. I'd rather look at pypy which has stackless support: http://pypy.org/features.html#stackless and is under active development.

Or look at golang which has the same type of primitives(microthreads, channel based communication and scheduling) built in.


I've searched extensively for years for something python-based which enables actual multi-core concurrency.. and after spending one week with golang, I strongly prefer go compared to anything I've found with python- multiprocess, stackless, pypy, etc. None of them let you reap the benefits of hardware like coroutines with communication channels in golang.


A very nice article and intro to concurrent programming. 10/10 would bang.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: