4 ms·
Introduction to Concurrent Programming with Stackless Python
- alt_ 13y ago> 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?
- polskibus 13y agoHas anyone used Stackless Python in production yet?
- peller 13y agoAccording 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.
- oddur 13y agoAs 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 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.
- jaytaylor 13y agoI'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.
- ef4 13y agoSeveral years ago I was using it in production at a major CDN. I would assume they still use it.
- paulhodge 13y agoThis 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.
- scribu 13y agoI 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.
- paulhodge 13y agoYep, yep. Stackless doesn't support parallelism either, it only enables cooperative multitasking.
- albertzeyer 13y agoNote 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.
- leke 13y agoA very nice article and intro to concurrent programming. 10/10 would bang.