Re: Short sleep precision

From: Jesper Juhl
Date: Sun Mar 20 2005 - 07:44:32 EST


On Sun, 20 Mar 2005, Jan Engelhardt wrote:

> Hello,
>
>
> I have found that FreeBSD has a very good precision of small sleeps --
> what's holding Linux back from doing the same? Using the code snippet below,
> FBSD yields between 2 and 80 us on the average while Linux is at
> "constantly" ~100 (with HZ=1000) and ~1000 (HZ=100).
>
Running your program here I see even worse values than that on 2.6.11-mm4
and it's also interresting to see that for a lot of continuous runs the
values reported drop steadily and eventually settle around ~1100, but if I
insert a sleep 1 between runs, then I see a steady ~1000 reported.
This is all with HZ = 1000


juhl@dragon:~/download/kernel/linux-2.6.11-mm4$ for i in `seq 1 40`; do ./a.out ; done
1414 us
1434 us
1423 us
1424 us
1433 us
1423 us
1420 us
1439 us
1434 us
1433 us
1463 us
1462 us
1450 us
1431 us
1403 us
1391 us
1376 us
1364 us
1362 us
1344 us
1353 us
1353 us
1334 us
1323 us
1313 us
1314 us
1293 us
1293 us
1273 us
1274 us
1271 us
1264 us
1264 us
1244 us
1244 us
1214 us
1214 us
1214 us
1183 us
1183 us

juhl@dragon:~/download/kernel/linux-2.6.11-mm4$ for i in `seq 1 10`; do (./a.out ; sleep 1) ; done
1113 us
997 us
997 us
998 us
997 us
997 us
996 us
997 us
996 us
996 us


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/