Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'languages,': 0.04; 'apis': 0.07; 'suppose': 0.07; 'python': 0.09; '(default': 0.09; 'interpreter,': 0.09; 'threads,': 0.09; 'language,': 0.11; 'programmer': 0.11; 'language': 0.14; '+1.': 0.16; 'agree.': 0.16; 'concurrency': 0.16; 'gil,': 0.16; 'non- trivial': 0.16; 'on)': 0.16; 'stepping': 0.16; 'threading': 0.16; 'threads': 0.16; 'usage,': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'jan': 0.18; '>>>': 0.18; 'memory': 0.18; '(or': 0.18; 'windows': 0.19; 'putting': 0.20; 'either.': 0.22; 'extends': 0.22; 'runs': 0.22; 'apps': 0.23; "python's": 0.23; "i've": 0.23; 'feature': 0.24; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'structures': 0.27; "doesn't": 0.28; '3.1': 0.29; 'cases.': 0.29; "d'aprano": 0.29; 'dan': 0.29; 'gil': 0.29; 'invoke': 0.29; 'steven': 0.29; 'objects': 0.29; 'probably': 0.29; "we're": 0.30; 'figure': 0.30; 'code': 0.31; 'running': 0.32; 'getting': 0.33; 'instead,': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; "can't": 0.34; 'project': 0.34; 'done': 0.34; 'needed': 0.35; 'mine': 0.35; 'problem,': 0.35; 'pm,': 0.35; 'too.': 0.35; 'something': 0.35; 'except': 0.36; 'tool': 0.36; 'but': 0.36; "didn't": 0.36; "i'll": 0.36; 'too': 0.36; 'possible': 0.37; 'level': 0.37; 'two': 0.37; 'moment': 0.37; 'virtual': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'step': 0.39; 'received:192': 0.39; 'application': 0.40; 'where': 0.40; 'received:192.168': 0.40; 'end': 0.40; 'think': 0.40; 'matter': 0.61; 'policy': 0.62; 'solve': 0.62; 'provide': 0.62; 'ever': 0.63; 'more': 0.63; 'other.': 0.64; 'levels': 0.66; 'subject:day': 0.66; 'header :Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'heavy': 0.83; 'low': 0.83; '2013': 0.84; "it'd": 0.84; 'much,': 0.84; 'shared,': 0.84; 'tolerance': 0.84; 'lately,': 0.91; 'promised': 0.91; 'same,': 0.91; 'angel': 0.93 Date: Mon, 14 Jan 2013 12:12:54 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Thought of the day References: <50f3869d$0$29983$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:mv9ZWkAkHxZsRciOhbLM+A1k3MjtvoiLk6ASgF6JtZO OeeUWeLI8KDuO3RNHXhOI18V0GL2hlAM47SjM4M9BGy37rHW2j xukBrCTtHcw33CWAfyaTQaoPBavX0vbj4Cr4in8CxsbzVlBocL i2vWA7YWqGk2AiF41NncxHL3S30gRELn+klf/toEcIJVIG1N2b mJRatfpcCjDDWkIRFEVSS0ByYWHa9sj2xblxxfeptMtxVSkVbm fQg6AbY38yvqAJ1qay1z8xGaUSo5K+0zvTJRUBuLBKInGjAGgn nwRN8gNOKNnIGtqP9gcHkdolYyclRiIH4faQzt4ebEVdgkngQ= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358183593 news.xs4all.nl 6880 [2001:888:2000:d::a6]:53595 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36799 On 01/14/2013 09:44 AM, Dan Sommers wrote: > On Mon, 14 Jan 2013 00:31:59 -0500, Dave Angel wrote: > >> On 01/13/2013 11:16 PM, Steven D'Aprano wrote: >>> A programmer had a problem, and thought Now he has "I know, I'll solve >>> two it with threads!" problems. >> ++10 > It took me a moment to figure it out, but in the end I smiled and I > agree: +1. > >> I've been thinking about threads lately, and have come to the tentative >> conclusion that they're a solution which has outlived its usefulness for >> 99% of the use cases. Much like the Windows 3.1 model of memory usage, >> where all memory was shared, and apps promised not to step too hard on >> each other. Or the "640k is more memory than any application will ever >> need" notion. > With this, however, I don't agree. If Python's GIL didn't interfere with > the concurrency of threads, Better minds than mine have tried very hard to eliminate the GIL, so for now I consider that a feature of Python. If the GIL weren't needed for the lowest levels of the interpreter, something else would be needed for all the possible data structures that need atomic updates. Hello semaphores, mutexes, etc. If threading were considered important in a language, it'd have a way to declare an object sharable (default off), and the low level code would go at full speed for any object not so declared. But the language would then provide guarantees for the standard objects that are marked as sharable. That's not current Python. > I can't think of a good reason to use > multiple processes instead, except to use a tool that runs outside the > Python virtual machine, or to provide more fault tolerance for long- > running server-like applications. We're all adults here, and if the > policy is to invoke the methods of objects as documented, then that > policy extends to stepping on (or not stepping on) the memory of other > threads, too. > > The APIs for threads and processes is pretty much the same, so I suppose > it doesn't matter much, either. Use the right tool for the job. > > Dan For other languages, I've done extensive work on projects with heavy multithreading, and getting it right is extremely difficult. Another way of putting it is that any non-trivial project with multithreading is probably buggy. -- DaveA