Thread-ID - how much could be?

Chris Angelico rosuav at
Fri Sep 12 03:49:07 CEST 2014

On Fri, Sep 12, 2014 at 11:29 AM, Steven D'Aprano
<steve+comp.lang.python at> 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
    for i in range(n):
    return (time.time()-start)/n
>>> test(10000)
>>> test(100000)

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!


More information about the Python-list mailing list