Thanx for the pointers. Yes I wasn't talking about porting the implementation of the multiprocessing module as much as its interface so that code written using it under python would just work under jython. The fact that it's using processes in cpython vs. threads in jython isn't terribly important I don't think. I'll definitely look into the tasks concepts. Appreciate the response.
-- Ben Scherrey
Ben,You want to use Java's thread pool support through an executor service. This works very well with Jython, and is discussed in our Jython book, http://jythonpodcast.hostjava.net/jythonbook/en/1.0/Concurrency.html#working-with-tasksWorking with tasks like this integrates well with regular Python code, if at the cost that it mixes in Java. I think that's a reasonable thing to do, the task model is generally a better abstraction than what we get with multiprocessing or threading.Lastly, porting multiprocessing really doesn't make a lot of sense (although it could certainly be done). Given the JVM footprint, coarse-grain parallelism at the level of processes would seem to be best done in the context of such tools as Hadoop.- JimOn Mon, Jul 26, 2010 at 5:12 AM, Benjamin Scherrey <firstname.lastname@example.org> wrote:
------------------------------------------------------------------------------We've got a webservice that we'd like to deploy on jython that presently uses multiprocessing. This doesn't seem to be available in jython yet. Since jython doesn't have the GIL and apparently handles threading better than CPython, is there a "best practice" method for jython to perform the same functionality? I'd like to avoid reinventing the wheel. Is there a plan/benefit to porting multiprocessing library to jython? It's nice to see jython coming along well with the 2.5 release. Unfortunately the first code I need to port uses libraries not available yet even though it's 100% pure python. I'm willing to work around it but just need some advice as to the best "jythonic" behaviour. :-)thanx,-- BenPS: We also wish we could run tornado under jython. Could epoll be replaced with some asyncore stuff and run?
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
Jython-users mailing list