Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Nov 2005 07:19:14 +0200
From:      "Mihail  Balikov" <misho@interbgc.com>
To:        "Viktor Vasilev" <viktor.vasilev@stud.tu-darmstadt.de>, <freebsd-hackers@freebsd.org>
Subject:   Re: select(2) timeout precision
Message-ID:  <003a01c5df6c$f7236080$2bccf0d5@misho>
References:  <20051101224223.GA737@ilium.0xdeadc0de.net>

next in thread | previous in thread | raw e-mail | index | archive | help
http://www.dragonflybsd.org/docs/nanosleep/

----- Original Message ----- 
From: "Viktor Vasilev" <viktor.vasilev@stud.tu-darmstadt.de>
To: <freebsd-hackers@freebsd.org>
Sent: Wednesday, November 02, 2005 12:42 AM
Subject: select(2) timeout precision


> 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
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003a01c5df6c$f7236080$2bccf0d5>