Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76438

Re: GIL detector

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'languages.': 0.04; '(even': 0.05; 'context': 0.07; 'alternatives': 0.09; 'referenced': 0.09; 'ruby,': 0.09; 'stack,': 0.09; 'sure,': 0.09; 'vast': 0.09; 'worse': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'thread': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'loud': 0.16; "object's": 0.16; 'personally,': 0.16; 'rarely': 0.16; 'subject:GIL': 0.16; 'switches': 0.16; 'threads,': 0.16; 'discussions': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'stefan': 0.19; 'thoughts': 0.19; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'affects': 0.24; 'exists': 0.24; 'module,': 0.24; 'simpler': 0.24; 'fine': 0.24; 'guys': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'extension': 0.26; 'long,': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'wonder': 0.29; "doesn't": 0.30; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'run': 0.32; 'development.': 0.33; 'programmers': 0.33; 'sense': 0.34; "i'd": 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'done': 0.36; 'doing': 0.36; 'similar': 0.36; 'so,': 0.37; 'too': 0.37; 'performance': 0.37; 'expect': 0.39; 'does': 0.39; 'sure': 0.39; 'most': 0.60; 'helps': 0.61; 'impact': 0.61; 'mentioned': 0.61; "you're": 0.61; 'back': 0.62; 'guarantee': 0.63; 'such': 0.63; 'happen': 0.63; 'choose': 0.64; 'more': 0.64; 'safe': 0.72; 'obvious': 0.74; 'day': 0.76; 'believe,': 0.84; 'penalty': 0.84; 'pike': 0.84; 'suits': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=asjemoy/E6Ituc0KRVTDJRBiiPW7+rdn44aQ0bg+qTU=; b=q/ZM4600DSojnNLU5tf1+u0bu84grGD9k63MDf9GwgimGtLJY/0QBdZ2CMUxnZO26+ toWMmvRWVgybl06vUOiiLhJNqb785ze1dDY/33nZNsfyQHLSTZmWrmcCx05WodjXdVYl JxtZNGz4lxhYHt2EZKupkSC8w8mBWS+N+kl7/PWchnplW7bpy3vS7+6kfb+NFbkdao2P lmMi5wg072swk2Y/fk+QlA/G/0z54Hy9TcUUuiaztcSWl8Xr6aV86Kn8Ay2OJGeObzwt 0Pot78MZgeqZEF7STpZYjec+j4bvM0M8HqEkV0MAY+jfstA0mrc4CzoVlEUBIGwO29AD YB5w==
MIME-Version 1.0
X-Received by 10.50.80.76 with SMTP id p12mr37562041igx.34.1408291648042; Sun, 17 Aug 2014 09:07:28 -0700 (PDT)
In-Reply-To <lsqhj1$ok8$1@ger.gmane.org>
References <53f0ba6c$0$29982$c3e8da3$5496439d@news.astraweb.com> <lsqhj1$ok8$1@ger.gmane.org>
Date Mon, 18 Aug 2014 02:07:27 +1000
Subject Re: GIL detector
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13073.1408291650.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408291650 news.xs4all.nl 2857 [2001:888:2000:d::a6]:41005
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76438

Show key headers only | View raw


On Mon, Aug 18, 2014 at 1:26 AM, Stefan Behnel <stefan_ml@behnel.de> wrote:
> I actually wonder more whether Python programmers are really all that
> obsessive about CPython's GIL. Sure, there are always the Loud Guys who
> speak up when they feel like no-one's mentioned it for too long, but I'd
> expect the vast majority to be just ok with the status quo and not think
> about it most of the time. Or, well, think about it when one of the Loud
> Guys takes the megaphone, but then put their thoughts back in the attic and
> keep doing their daily work.
>
> Personally, I like the GIL. It helps me keep my code simpler and more
> predictable. I don't have to care about threading issues all the time and
> can otherwise freely choose the right model of parallelism that suits my
> current use case when the need arises (and threads are rarely the right
> model). I'm sure that's not just me.

The GIL doesn't prevent threads, even. It just affects when context
switches happen and what can run in parallel. As I've often said,
threads make fine sense for I/O operations; although that may start to
change - I'm sure the day will come when asyncio is the one obvious
way to do multiplexed I/O in Python.

The GIL means you can confidently write code that uses CPython's
refcounting mechanisms (whether overtly, in an extension module, or
implicitly, by just doing standard Python operations), and be
confident that internal state won't be corrupted... or, more
accurately, be confident that you're not paying a ridiculous
performance penalty (even in a single-threaded program) for the
guarantee that internal state won't be corrupted. Pike has a similar
global lock; so, I believe, does Ruby, and so do several other
languages. It's way more efficient than a lot of the alternatives. I
can't speak for Ruby, but Pike has had periodic discussions about
lessening the global lock's impact (one such way is isolating
purely-local objects from those with global references; if an object's
referenced only from the execution stack, there's no way for any other
thread to see it, ergo it's safe to work with sans locks - considering
that a lot of data manipulation will be done in this way, this could
give a lot of parallelism), and yet the GIL still exists in Python and
Pike, because it really is better than the alternatives - or at least,
insufficiently worse to justify the transitional development.

We do not have a problem here.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

GIL detector Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-18 00:21 +1000
  Re: GIL detector Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-08-17 16:40 +0200
    Re: GIL detector Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-18 01:01 +1000
  Re: GIL detector Chris Angelico <rosuav@gmail.com> - 2014-08-18 00:52 +1000
  Re: GIL detector Stefan Behnel <stefan_ml@behnel.de> - 2014-08-17 17:26 +0200
    Re: GIL detector Grant Edwards <invalid@invalid.invalid> - 2014-08-18 15:05 +0000
  RE: GIL detector "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-08-17 16:01 +0000
    RE: GIL detector Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-18 02:43 +1000
  Re: GIL detector Chris Angelico <rosuav@gmail.com> - 2014-08-18 02:07 +1000
  Re: GIL detector Chris Angelico <rosuav@gmail.com> - 2014-08-18 02:12 +1000

csiph-web