11/17/2005 05:55 PM, linux-os (Dick Johnson) wrote/a écrit:
On Thu, 17 Nov 2005, Dag Nygren wrote:
:
real 0m8.000s
user 0m0.000s
sys 0m0.000s
On an unprivilged account, I get this with
version 2.6.13.4
Script started on Thu 17 Nov 2005 11:44:47 AM EST
LINUX> time ./xxx
sched_setscheduler returned: -1
Operation not permitted
real 0m2.000s
user 0m0.000s
sys 0m0.001s
LINUX> uname -r
2.6.13.4
LINUX> exit
Script done on Thu 17 Nov 2005 11:45:07 AM EST
From the root account where the scheduler could be set:
Script started on Thu 17 Nov 2005 11:45:29 AM EST
[root@chaos root]# time /tmp/xxx
real 0m2.001s
user 0m0.000s
sys 0m0.001s
[root@chaos root]# exit
Script done on Thu 17 Nov 2005 11:45:53 AM EST
... essentially the same thing. And 2 seconds, not 8.
The HZ value for my kernel is 1000. It you are at 100 HZ,
that might explain it.
No, it means he is at 250 HZ.
Note that nanosleep() doesn't claim to be able to sleep
less than the resolution of some kernel timer. It just takes
parameters in seconds and nanoseconds.
In general small nanosleep() returns between 1/HZ and 2/HZ. In this
code, the sleep is (indirectly) synchronised on a tick so it's always
2/HZ, the worse!
1000 small nanosleeps take therefore 1000 * 2/HZ s = 8s :-)
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]