select(2) timeout precision
Viktor Vasilev
viktor.vasilev at stud.tu-darmstadt.de
Tue Nov 1 14:42:31 PST 2005
Hello fellow hackers,
I'm writing a piece of code, that basically does the following in a
thread:
tick.tv_sec = 0;
tick.tv_usec = 10000;
gettimeofday(&t1, NULL);
select(0, NULL, NULL, NULL, &tick);
gettimeofday(&t2, NULL);
With FreeBSD 5.4-RELEASE I almost constantly get ~20000 microseconds
delta. That is with 100HZ kernel on PIII 500MHz or Sempron 64 2800+
running in i386 mode. It also doesn't matter if I use usleep or
select. I've tested the code on linux with 2.6.11 kernel and there I
not only get the 10000 us sleep, but I can also set it to 5000 us and
it still runs very accurately.
So my question is, is this a FreeBSD limitation of some kind, and is
there a way to circumvent it?
Best regard,
Viktor
--
I think and think for months and years. Ninety nine times, the
conclusion is false. The hundredth time I am right.
-- Albert Einstein
More information about the freebsd-hackers
mailing list