Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36799
| Date | 2013-01-14 12:12 -0500 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: Thought of the day |
| References | <50f3869d$0$29983$c3e8da3$5496439d@news.astraweb.com> <mailman.492.1358155623.2939.python-list@python.org> <nRUIs.51167$On7.15414@newsfe16.iad> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.505.1358183593.2939.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Thought of the day Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-14 04:16 +0000
Re: Thought of the day Dave Angel <d@davea.name> - 2013-01-14 00:31 -0500
Re: Thought of the day Dan Sommers <dan@tombstonezero.net> - 2013-01-14 14:44 +0000
Re: Thought of the day Dave Angel <d@davea.name> - 2013-01-14 12:12 -0500
Re: Thought of the day alex23 <wuwei23@gmail.com> - 2013-01-14 04:09 -0800
Re: Thought of the day Tim Chase <python.list@tim.thechases.com> - 2013-01-14 08:15 -0600
Re: Thought of the day Chris Angelico <rosuav@gmail.com> - 2013-01-15 01:18 +1100
Re: Thought of the day Grant Edwards <invalid@invalid.invalid> - 2013-01-14 15:08 +0000
Re: Thought of the day Michael Torrie <torriem@gmail.com> - 2013-01-14 10:37 -0700
Re: Thought of the day John Gordon <gordon@panix.com> - 2013-01-14 18:09 +0000
Re: Thought of the day Michael Torrie <torriem@gmail.com> - 2013-01-14 11:25 -0700
Re: Thought of the day Dave Angel <d@davea.name> - 2013-01-14 09:31 -0500
Re: Thought of the day Antoine Pitrou <solipsis@pitrou.net> - 2013-01-15 16:48 +0000
Re: Thought of the day DJC <djc@news.invalid> - 2013-01-15 22:54 +0000
Re: Thought of the day Tim Golden <mail@timgolden.me.uk> - 2013-01-15 16:59 +0000
Re: Thought of the day Chris Angelico <rosuav@gmail.com> - 2013-01-16 07:27 +1100
Re: Thought of the day John Ladasky <john_ladasky@sbcglobal.net> - 2013-01-16 23:26 -0800
csiph-web