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


Groups > comp.lang.python > #55424

Re: Multiple scripts versus single multi-threaded script

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'debug': 0.07; 'high-level': 0.09; 'properly.': 0.09; 'subject:script': 0.09; 'wrong,': 0.09; 'python': 0.11; 'thread': 0.14; 'downside': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'headaches': 0.16; 'interacting,': 0.16; 'roy': 0.16; 'sorts': 0.16; 'subject:versus': 0.16; 'language': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'handles': 0.22; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'another': 0.32; '(i.e.': 0.33; 'continuing': 0.33; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'two': 0.37; 'problems': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'problems.': 0.60; 'simple': 0.61; 'more': 0.64; 'smith': 0.68; 'sharing': 0.69; 'allocation': 0.74; '2013': 0.98
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:to :content-type; bh=7mS4Nsqb/O6IjYIAP1KQ4eHSFPGbRc6s7xGBiq59/pM=; b=IUJXu13eD5pjq5k9/nIa5VOfj5AQdJPMwCkka7JHo1k1oUgZ9OPcdnduKcd/j+Kl1r alG56IiZ0zfpDXo86r8ttVxia/hmoDQip3976EcRVpq9hjXYKAvhF2xGTGDYu8TEpZwF RjYt1W6Ml/lCo1tLULnd8zcVNAy9OGjMfPtfbjFqB58OWi4mBd9jGxlbQ0fteNK0wDRa QfGdLFdEOZcYnW6w5mQQHGlZsVlhJAXy4uLNiNghpr7wzwuj11VHWhlaBSuXN8mSYroP HD7RT+XkporDjJN9aGvjomhIi9kkMtYQm2Zdq+UCRq2ZGUC19kv4ubOqPUJjMy+m+7Qr zt5A==
MIME-Version 1.0
X-Received by 10.68.125.226 with SMTP id mt2mr1577824pbb.115.1380819000185; Thu, 03 Oct 2013 09:50:00 -0700 (PDT)
In-Reply-To <roy-451497.12415103102013@news.panix.com>
References <f01b2e7a-9fc7-4138-bb6e-447d31179f2d@googlegroups.com> <roy-451497.12415103102013@news.panix.com>
Date Fri, 4 Oct 2013 02:50:00 +1000
Subject Re: Multiple scripts versus single multi-threaded script
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.684.1380819470.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380819470 news.xs4all.nl 15908 [2001:888:2000:d::a6]:51883
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55424

Show key headers only | View raw


On Fri, Oct 4, 2013 at 2:41 AM, Roy Smith <roy@panix.com> wrote:
> The downside to threads is that all of of this sharing makes them much
> more complicated to use properly.  You have to be aware of how all the
> threads are interacting, and mediate access to shared resources.  If you
> do that wrong, you get memory corruption, deadlocks, and all sorts of
> (extremely) difficult to debug problems.  A lot of the really hairy
> problems (i.e. things like one thread continuing to use memory which
> another thread has freed) are solved by using a high-level language like
> Python which handles all the memory allocation for you, but you can
> still get deadlocks and data corruption.

With CPython, you don't have any headaches like that; you have one
very simple protection, a Global Interpreter Lock (GIL), which
guarantees that no two threads will execute Python code
simultaneously. No corruption, no deadlocks, no hairy problems.

ChrisA

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


Thread

Multiple scripts versus single multi-threaded script JL <lightaiyee@gmail.com> - 2013-10-03 09:01 -0700
  Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 12:41 -0400
    Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:50 +1000
      Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 14:28 -0400
        Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 04:36 +1000
          Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 15:53 -0400
            Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 08:22 +1000
    Re: Multiple scripts versus single multi-threaded script Dave Angel <davea@davea.name> - 2013-10-03 18:40 +0000
    Re: Multiple scripts versus single multi-threaded script Jeremy Sanders <jeremy@jeremysanders.net> - 2013-10-04 10:02 +0200
    Re: Multiple scripts versus single multi-threaded script Grant Edwards <invalid@invalid.invalid> - 2013-10-04 16:38 +0000
  Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:42 +1000

csiph-web