time.sleep(1) sometimes runs for 200 seconds under windows

Mladen Adamovic adamm_n0 at spamm_blic.net
Tue Feb 28 10:48:02 EST 2006


Magnus Lycka wrote:
> On Windows that it. At least on Linux and Solaris, time.clock() returns
> CPU time. If time.clock() returns significantly different values before
> and after time.sleep(1), there's something seriously broken in sleep on
> such platforms.

No!
When process run the sleep, the operating system give other processes to 
run and it takes time (so called time slice)  to get back to the 
original process.

Recently I invoked Runtime.sleep() from Java on Centos 4.2 and it might 
take up to 1 sec(!) to come from the sleep no matter what you put as the 
sleep parameter.

Basically each process runs for around 20ms and then the other process 
get priority. I'm not sure why those Codecs run OK when I watch DVD 
movie while running other Java application which use processor and hard 
disc quite intensivly, it seems that they got slices regulary, I'm not 
sure way.

So, once more when you go to "sleep" other process get the slice so it 
could take more time then predicted to continue.

-- 
Mladen Adamovic
http://home.blic.net/adamm
http://www.shortopedia.com
http://www.froola.com



More information about the Python-list mailing list