Light Speed Socket Connections

Skip Montanaro skip at pobox.com
Thu Jul 12 19:44:11 CEST 2001


    Steve> Is my CPU usage really ~100% during those sleeps?

Maybe, maybe not.  Win95 is a single user OS.  The CPU has to be doing
something during those 2.5 second rest periods.  There's nobody else to
credit the time to.  On the other hand, maybe it really does use a busy
wait.

On a multi-user OS (Mandrake Linux in my case, but there are plenty others
to choose from), I see this:

    >>> for i in range(10):
    ...   time.sleep(2.5)
    ...   print time.time(), time.clock()
    ... 
    994959584.635 0.65
    994959587.135 0.65
    994959589.635 0.65
    994959592.135 0.65
    994959594.635 0.65
    994959597.135 0.65
    994959599.635 0.65
    994959602.135 0.65
    994959604.635 0.65
    994959607.135 0.65

-- 
Skip Montanaro (skip at pobox.com)
(847)971-7098




More information about the Python-list mailing list