Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: Is Python a commercial proposition ? Date: Tue, 31 Jul 2012 08:04:57 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 25 Message-ID: References: <-1016624622349492799@unknownmsgid> <50173d9c$0$29978$c3e8da3$5496439d@news.astraweb.com> <7x62941qtc.fsf@ruckus.brouhaha.com> <50177b4d$0$29867$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1343736301 22227 127.0.0.1 (31 Jul 2012 12:05:01 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 31 Jul 2012 12:05:01 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:26303 In article <50177b4d$0$29867$c3e8da3$5496439d@news.astraweb.com>, Steven D'Aprano wrote: > Do they consider that perhaps there are alternatives to threads? There's basically two reasons people use threads. First is because it's a convenient way to multiplex short-lived tasks on a single processor. What people tend to forget is that we managed to do that before there were threads. Event loops still work perfectly fine. For an interesting example, http://www.gevent.org/. Second is because we have multiple long-lived, compute-bound tasks and want to be able to take advantage of multiple processors. For that, multiprocessing works just fine most of the time. And multiprocess has the advantage over multithreading in that the processes can run on different machines, so you're not limited by the number of cores you can get on a single CPU. What multiprocessing doesn't give you is fine-grain task switching. So we're left with the set of jobs which consist of many (but not more than the number of cores on one CPU) compute-bound tasks, that we know how to parallelize, and require fine-grain task switching. Sure, that's an important set of jobs, but there's a whole huge world of computing that doesn't fit into that box.