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


Groups > comp.lang.python > #7181

Re: GIL in alternative implementations

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'thread,': 0.04; 'executing': 0.05; 'though.': 0.07; 'def': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'concurrency,': 0.16; 'f()': 0.16; 'functools': 0.16; 'furman': 0.16; 'subject:GIL': 0.16; 'subject:alternative': 0.16; 'subsequent': 0.16; 'tue,': 0.17; 'cheers,': 0.19; 'header :In-Reply-To:1': 0.21; 'loop': 0.22; 'received:209.85.161.46': 0.23; 'received:mail-fx0-f46.google.com': 0.23; 'fix': 0.23; '(and': 0.25; 'function': 0.25; 'received:209.85.161': 0.26; 'example': 0.27; "i'm": 0.27; 'message-id:@mail.gmail.com': 0.28; 'problem': 0.28; 'import': 0.29; 'threads': 0.30; 'changes': 0.30; 'print': 0.31; 'this.': 0.31; 'to:addr:python-list': 0.33; 'idea': 0.36; 'similar': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'arising': 0.37; 'partial': 0.37; 'two': 0.37; 'could': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'making': 0.67; 'imagine': 0.72; '11:51': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=j+pnGKEZAzVuAoD4YhgzWRyxA23VlBjWVf0GVjrJ7as=; b=ep3yBTTAD/z5WYPKqYf0BZx+e5o4GnXKJRCsIQH0/ujrVLFjixUaS0tkMGoPIkHn7L 9tl81RnyNhvMYChBJNp/KmU0SnUDam4ARe/WhVhCrhwqrRqS9fv6mrY3tp+o5RL8Tqe3 O76x/B8pCFCiuAC+5qVkz3CfZi6Fp8BtqPTyY=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=tg30n07Fsi8HBHB48j2KX50YWA14K23bNDm4RQI1k58q+992kUPYxSrY7+3s37LKlf sPtUHTNmgwozRMXfnXjwAORuI7G5fPiZ2xEjA1cSn1S0wDSkRl24S8jJbmQP6YypuApS Bh998TUzZAxlcsQcPkV1liXaS4Vn0LyUg/LPs=
MIME-Version 1.0
In-Reply-To <4DEE6504.50906@stoneleaf.us>
References <7d244fb0-5457-4070-8569-306797f70131@glegroupsg2000goo.googlegroups.com> <4DEE6504.50906@stoneleaf.us>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 7 Jun 2011 14:22:50 -0600
Subject Re: GIL in alternative implementations
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2545.1307478202.9059.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 82.94.164.166
X-Trace 1307478202 news.xs4all.nl 49179 [::ffff:82.94.164.166]:47670
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7181

Show key headers only | View raw


On Tue, Jun 7, 2011 at 11:51 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
>> I'm not sure where he gets the idea that this has any impact on
>> concurrency, though.
>
> What if f has two calls to self.h() [or some other function], and self.h
> changes in between?
>
> Surely that would be a major headache.

I could imagine a problem similar to the non-atomic increment example
arising from continuations.

from functools import partial

def g(value):
    print(value)
    return partial(g, value+1)

f = partial(0)
for i in range(10000):
    f = f()

With a single thread, this will print the numbers 0 to 9999.  With
multiple threads executing the loop simultaneously, not so much.  Note
that this is not the same example as the non-atomic increment, because
making "value += 1" atomic would not fix this.  You would have to make
the entire function call (and subsequent assignment) atomic to make
this concurrent.

Cheers,
Ian

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


Thread

Re: GIL in alternative implementations Carl Banks <pavlovevidence@gmail.com> - 2011-06-07 10:08 -0700
  Re: GIL in alternative implementations Ethan Furman <ethan@stoneleaf.us> - 2011-06-07 10:51 -0700
  Re: GIL in alternative implementations Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-07 14:22 -0600
  Re: GIL in alternative implementations Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-07 14:23 -0600

csiph-web