From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 2 05:19:21 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49BBA16A41F for ; Wed, 2 Nov 2005 05:19:21 +0000 (GMT) (envelope-from misho@interbgc.com) Received: from mail.interbgc.com (mx01.interbgc.com [217.9.224.225]) by mx1.FreeBSD.org (Postfix) with SMTP id 656A743D46 for ; Wed, 2 Nov 2005 05:19:19 +0000 (GMT) (envelope-from misho@interbgc.com) Received: (qmail 34647 invoked from network); 2 Nov 2005 05:19:18 -0000 Received: from misho@interbgc.com by keeper.interbgc.com by uid 1002 with qmail-scanner-1.14 (uvscan: v4.2.40/v4374. spamassassin: 2.63. Clear:SA:0(-2.6/8.0):. Processed in 3.300011 secs); 02 Nov 2005 05:19:18 -0000 X-Spam-Status: No, hits=-2.6 required=8.0 Received: from topilapi-wlan.ddns.cablebg.net (HELO misho) (213.240.204.43) by mx01.interbgc.com with SMTP; 2 Nov 2005 05:19:14 -0000 Message-ID: <003a01c5df6c$f7236080$2bccf0d5@misho> From: "Mihail Balikov" To: "Viktor Vasilev" , References: <20051101224223.GA737@ilium.0xdeadc0de.net> Date: Wed, 2 Nov 2005 07:19:14 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Cc: Subject: Re: select(2) timeout precision X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mihail Balikov List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2005 05:19:21 -0000 http://www.dragonflybsd.org/docs/nanosleep/ ----- Original Message ----- From: "Viktor Vasilev" To: 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" >