lkml.org 
[lkml]   [1999]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSleep-Slowdown
Hello,


while developing a compiler (www.informatik.uni-kiel.de/~sacbase),
a problem with newer linux-kernels occured.

I tracked it down to the following:

Using this small program to test it, the executiontime on Linux <= 2.1.126
and on Sparc-Solaris is nearly 1ms.

Since 2.1.127 the time is 5 seconds, whoch means 10ms per sleep(0).

-------------------- 8< ------------------------
int main()
{
int i;
for (i=0; i<=500; i++)
{
sleep(0);
}
return(0);
}
-------------------- 8< ------------------------
Viewing it in strace results in nanosleep(0,0).
The manpage for nanosleep() says, the (sleep-)time may increase up to one
cycle (10ms) (Linux-man and Solaris-man).

I inserted a line like

if(arg==0) return 0;
to sys_nanosleep() in sched.c, and the "problem" was fixed.

It surely does not make sense to call sleep(0), but in that case,
it would be nice to return emmediatly.

Are there any oposite oppinions ?
Could that fix be included into the official kernel ?




jfe@informatik.uni-kiel.de


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans