Re: Can't sleep less than 20 ms

Benno Senoner (benno@gardena.net)
Fri, 02 Jul 1999 23:48:51 +0200


--------------AB37507047F80AF674DE7D41
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> Hi,
>
> I know Linux on i386 has a timer resolution of 10 ms, but
> why I can't sleep for 10 ms, I can only sleep at
> interval of 20 , 30, 40 ... ms.
>
> This what happpends
>
> usleep ( <= 10*1000) will sleep for 20 ms
> usleep ( <10*1000 <= 20*1000) will sleep for 30 ms
> usleep ( <20*1000 <= 30*1000) will sleep for 40 ms
>
> I'm runing 2.2.10.
>
> Thanks.
>
> Dong
>

I noticed the same problem, the only cure was to increase HZ to 1000,
to
get a better usleep() resolution, but it seems that you usleep() sleeps
at
least 2-3 interrupt ticks,
for example with the HZ=400 patch I was unable to sleep for less than
7.5 ms ( 3 ticks) in a RT scheduled thread, using usleep(3000)

for values <3000 , there was no sleep at all, and the RT thread didn't
release
the CPU, and therefore I was forced to reboot my machine.
:-)

can anyone confirm these symptoms ?

regards,
Benno.

--------------AB37507047F80AF674DE7D41
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

      Hi,

      I know Linux on i386 has a timer resolution of 10 ms, but
      why I can't sleep for 10 ms, I can only sleep at
      interval of  20 , 30, 40 ... ms.

      This what happpends

      usleep ( <= 10*1000)           will sleep for  20 ms
      usleep ( <10*1000 <= 20*1000)  will sleep for  30 ms
      usleep ( <20*1000 <= 30*1000)  will sleep for  40 ms

      I'm runing 2.2.10.

      Thanks.

      Dong


I noticed the same problem,  the only cure was to increase HZ to 1000, to
get a better usleep() resolution, but it seems that you usleep() sleeps at
least 2-3 interrupt ticks,
for example with the HZ=400 patch I was unable to sleep for less than
7.5 ms ( 3 ticks) in a RT scheduled thread, using usleep(3000)

for values <3000 , there was no sleep at all, and the RT thread didn't release
the CPU, and therefore I was forced to reboot my machine.
:-)

can anyone confirm these symptoms ?

regards,
Benno.
  --------------AB37507047F80AF674DE7D41-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/