Date: Tue, 1 Nov 2005 23:42:23 +0100 From: Viktor Vasilev <viktor.vasilev@stud.tu-darmstadt.de> To: freebsd-hackers@freebsd.org Subject: select(2) timeout precision Message-ID: <20051101224223.GA737@ilium.0xdeadc0de.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051101224223.GA737>
