Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3.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.052 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; '32-bit': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; 'thread': 0.14; 'build?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Thread': 0.16; 'wrote:': 0.18; 'year,': 0.18; 'bit': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'nearly': 0.26; 'pass': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "d'aprano": 0.31; 'long.': 0.31; 'sep': 0.31; 'steven': 0.31; 'ups': 0.31; 'probably': 0.32; 'linux': 0.33; 'running': 0.33; 'fri,': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'much.': 0.36; 'subject:?': 0.36; 'seconds': 0.37; 'two': 0.37; 'that,': 0.38; '12,': 0.39; 'days': 0.60; 'even': 0.60; 'hardware': 0.61; 'power': 0.76; 'blow': 0.84; 'skip:6 20': 0.84; 'uptime': 0.84; 'subject:much': 0.91; '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=zpVnpnp7kvdW5+65m+ibrOvDtvt2MeG2pd1p0T3BRgw=; b=erN+zr+HOqrg5VJLxpw2ZzUE+B/23cunt3anl5rVoeejO5gkOTznQjW0RVTSOFEhZd NOL81CJ5n8wJjYlzMVUCdJTmIpurSJB6KnNi5nI6q6vJ5o1k6celmXj9sITApyn47GNV 0Uoh27TDP3eeP7yr3+CDIYDlU+BsMwmapPLZlFr9vJAX+d6vQsMMhr4aHCFGfYWYjwJC +O7i/HmggPN1ztznRItBMmr0aRVBBKsk7blL2/LxZhKaWbUOhMiu4bBiYosuTh2RIInE zqkVeB2FONNLazOnfRx0IfKlet9tuNzCV6nGQhZBN4gtWe2M10zo2wPsSNx2MRt4DxDt rAfQ== MIME-Version: 1.0 X-Received: by 10.51.17.2 with SMTP id ga2mr7610794igd.2.1410486547325; Thu, 11 Sep 2014 18:49:07 -0700 (PDT) In-Reply-To: <54124c95$0$29991$c3e8da3$5496439d@news.astraweb.com> References: <20140911193018.GA24416@arxnet.hu> <54124c95$0$29991$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 12 Sep 2014 11:49:07 +1000 Subject: Re: Thread-ID - how much could be? 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410486555 news.xs4all.nl 2888 [2001:888:2000:d::a6]:59666 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77788 On Fri, Sep 12, 2014 at 11:29 AM, Steven D'Aprano wrote: > I know that some Linux > systems can have an uptime over a year, perhaps even two years, but I think > that nearly 300 years is asking a bit much. Your hardware probably won't > keep working that long. I've had over two years of uptime. Currently looking at 85 wk 4d 02:11:28 since the UPS and power failed simultaneously, but before that, over two years. But what about a 32-bit build? You could blow 1<<31 in about a month of milliseconds, and I just tried, and on this 32-bit Windows box I have here, I can start 10K threads in under a second: >>> def test(n): def f(): pass start=time.time() for i in range(n): t=threading.Thread(target=f) return (time.time()-start)/n >>> test(10000) 6.562459468841553e-05 >>> test(100000) 6.906198978424073e-05 So if it's 7e-5 seconds per thread (65-69 microseconds), that'd be less than two days to blow a 32-bit maxint. You could probably keep even a Win 98 computer running that long! ChrisA