paul santa clara on 7 Dec 2010 16:35:23 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: December 15th - RSVP - Tornado with Gavin Roy


Hey Tom,
    Thanks for the thoughtful reply. :)

Just to be clear, and I know Toby alluded to this, while Python threads via the `threading' module are in fact hampered by the GIL[1], if you have a truly CPU-bound problem that lends itself to parallelism, Python's `multiprocessing' module is very capable and will
 
Yep, Yep.  I am huge fan of the venerable/tried & true *nix fork/join model, especially when combined with copy-on-write semantics.  I had a fascinating conversation with Matthias Radestock(rabbitmq) where he explicitly stated that threads were an incorrect mechanism for concurrency and that only explicit data sharing/synchronization via some kind of IPC messaging system made any real sense.  The man takes a hard line but what do you expect from a full time erlang dev?  It's an interesting perspective and one that is far from idiomatic in most java/.net communities where native threads are supported.  
 
[1] - It should be noted that Python threads are _real_ OS-level threads they are not "green threads." However, CPython only allows a single thread to be executing within the interpreter at once ... this is enforced by the GIL. For example, using the threading module in Jython will take advantage of the underlying JVM threading ... which may or may not be truly concurrent. Likewise using threading in IronPython will use the underlying CLR's threading capabilities ... which may or may not be truly concurrent.

Very valid points, but having used both jruby and ironruby which feature similar facilities, there are, in my experience, usually compatibility surprises going down this path.  Ruby mutex's on the CLR, for instance, seemed to follow their own rules.  The main purpose of my question wasn't what to see what _can be_ done but rather to get a feel for the design decisions the twisted/tornado dev's had to face when building an event driven framework for the python masses.  Now that you bring it up though, I am curious.  Has anyone tried running twisted/tornado on the jvm or clr? Was it worth it?

-Paul SC