Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77788
| References | <20140911193018.GA24416@arxnet.hu> <lusua3$a4t$1@ger.gmane.org> <mailman.13944.1410471154.18130.python-list@python.org> <54124c95$0$29991$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2014-09-12 11:49 +1000 |
| Subject | Re: Thread-ID - how much could be? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13952.1410486555.18130.python-list@python.org> (permalink) |
On Fri, Sep 12, 2014 at 11:29 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-11 23:32 +0200
Re: Thread-ID - how much could be? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-12 11:29 +1000
Re: Thread-ID - how much could be? Chris Angelico <rosuav@gmail.com> - 2014-09-12 11:49 +1000
Re: Thread-ID - how much could be? Skip Montanaro <skip@pobox.com> - 2014-09-11 20:38 -0500
Re: Thread-ID - how much could be? Cameron Simpson <cs@zip.com.au> - 2014-09-12 13:41 +1000
Re: Thread-ID - how much could be? Chris Angelico <rosuav@gmail.com> - 2014-09-12 15:41 +1000
Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-12 08:30 +0200
Re: Thread-ID - how much could be? dieter <dieter@handshake.de> - 2014-09-13 08:56 +0200
Re: Thread-ID - how much could be? Peter Otten <__peter__@web.de> - 2014-09-13 09:48 +0200
Re: Thread-ID - how much could be? Martin Skjöldebrand <shieldfire@gmail.com> - 2014-09-13 12:09 +0200
Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-13 12:32 +0200
Re: Thread-ID - how much could be? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-09-16 10:53 +0200
csiph-web