Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'handler': 0.05; 'differently.': 0.09; 'pretend': 0.09; 'whichever': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'accesses': 0.16; 'elsewhere.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'implies': 0.16; 'non-blocking': 0.16; 'reedy': 0.16; 'resource.': 0.16; 'throughput': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'thu,': 0.19; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'generally': 0.29; 'message- id:@mail.gmail.com': 0.30; 'program,': 0.31; 'piece': 0.31; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'disk': 0.36; 'ram': 0.36; 'words,': 0.36; 'next': 0.36; 'depends': 0.38; 'resource': 0.38; 'itself': 0.39; 'structure': 0.39; 'enough': 0.39; 'skip:u 10': 0.60; 'worry': 0.60; "you're": 0.61; 'become': 0.64; 'frank': 0.68; 'safe': 0.72; 'increase': 0.74; 'potentially': 0.81; 'asynchronous': 0.84; 'viable': 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=72qalYfa7zZn40Kph/ayQPGNpDEGagPCvuRETYHUgSA=; b=f5X7P5FQ1+GBd3K2Cf8g1zsk/OlE4WTrvAV7sGI6NY7QFG8BWB5/cnWysFjENlqalt +V19vbBNkLN8q2m4QqN+qaRGkDh1giHz0g/R8LQrRyaGgwCRWiHpLe1bXj1u0C2rcERh VRRwREsh7uTiYSnR6ExD4POXx2NfGCrqONAkpBKbM+hR4jVRAtfEOzqoPyRZUkKV//iq IQ1ls2z/fbLzbxVQiulMHyUrtxEgXRzrErYVztDLu9oLZJtmnljERGEuyyIXAMYXt3Tg vsnjl+LAQgibRFxLE9Z68wCO6j1dzMgm6K1oQaDrg+Z5fPW89TA2Bq3zxJINxi9s6taQ uQAw== MIME-Version: 1.0 X-Received: by 10.66.164.229 with SMTP id yt5mr13321973pab.67.1397060743232; Wed, 09 Apr 2014 09:25:43 -0700 (PDT) In-Reply-To: References: <87d2gt4td2.fsf@elektro.pacujo.net> <7xha651yx2.fsf@ruckus.brouhaha.com> <877g70wg8p.fsf@elektro.pacujo.net> Date: Thu, 10 Apr 2014 02:25:43 +1000 Subject: Re: threading From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397060752 news.xs4all.nl 2864 [2001:888:2000:d::a6]:41539 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69964 On Thu, Apr 10, 2014 at 2:14 AM, Terry Reedy wrote: > On 4/9/2014 10:30 AM, Frank Millman wrote: > >> In other words, non-blocking implies that everything required to pass off >> the request to a handler and be ready to deal with the next one must >> already >> be in memory, and it must not rely on communicating with any outside >> resource at all. Is this correct? > > > Chris said no, I would have said yes, but I think we understand the above > differently. I said no because I see asynchronous I/O as a perfectly viable structure for a program, which means that a non-blocking handler is allowed to communicate with outside resources. Conversely, if you see "a non-blocking handler" as meaning the one small piece that runs uninterruptibly, then you might say that yes, it must not rely on any outside resource. Of course, it depends on where you're looking. Memory is itself an outside resource that can potentially take a long time to give a result - just look at what happens when you dip into swap space, and RAM accesses become disk accesses. But generally, you go asynchronous in order to increase your throughput; and if you're churning through your page file, well, that's going to kill throughput whichever way you look at it. It's generally safe enough to pretend that RAM can be accessed in-line, and worry about the slowdowns elsewhere. ChrisA