From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 25 10:51:54 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4087016A400 for ; Mon, 25 Feb 2008 10:51:54 +0000 (UTC) (envelope-from sharadc@in.niksun.com) Received: from in.niksun.com (210.18.76.166.sify.net [210.18.76.166]) by mx1.freebsd.org (Postfix) with ESMTP id C10F113C45D for ; Mon, 25 Feb 2008 10:51:53 +0000 (UTC) (envelope-from sharadc@in.niksun.com) Received: from sharadc.in.niksun.com (unknown [10.60.5.27]) by in.niksun.com (Postfix) with ESMTP id CA7535D3A; Mon, 25 Feb 2008 16:36:37 +0530 (IST) From: Sharad Chandra Organization: NIKSUN To: freebsd-hackers@freebsd.org Date: Mon, 25 Feb 2008 16:15:02 +0530 User-Agent: KMail/1.9.4 References: <200802221558.42443.sharadc@in.niksun.com> <200802251440.56435.sharadc@in.niksun.com> <200802251039.59767.wundram@beenic.net> In-Reply-To: <200802251039.59767.wundram@beenic.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802251615.03040.sharadc@in.niksun.com> Cc: "Heiko Wundram \(Beenic\)" Subject: Re: usleep X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2008 10:51:54 -0000 ,---- [Heiko Wundram (Beenic) wrote:] | Am Montag, 25. Februar 2008 10:10:56 schrieb Sharad Chandra: | > So does it mean, freebsd has limitation. sleeping will only work for its | > value more than 1 milli sec because % of +- error value is comparitivly | > low? I am curious to know, is there any method which sleeps for few | > microseconds. Some one please give me link where to look for "select". | | No, this does not mean that FreeBSD has a limitation, but rather that | FreeBSD is not a real-time operating system. You'll see the similar | behaviour on pretty much any other operating system that is _not_ a RTOS | (for example, Windows has a fixed resolution of non-Multimedia-Timers of | around 10ms [where Multimedia Timers are a specific interface to sleep with | a higher resolution, designed for Multimedia applications, but the | resolution isn't that much higher, anyway], and on Linux, it also depends | on the Tick-Frequency, similar to FreeBSD's HZ setting, but actually I | don't know how the tickless Linux-kernel [which is implemented only in the | latest versions, and not default anyway] behaves here). | | There is no way (AFAIK) for a userland application to _sleep_ for a finer | grained amount of time than a timeslice, except in a busy loop which calls | gettimeofday or similar repeatedly to break when the "timeout" occurs, but | even then you don't have a guarantee that you won't sleep longer, simply | because the process might be preempted just before the timeout occurs | because another process also wants its timeslice. | | But, more specifically, why do you need to sleep for a short time in a user | process anyway? Normally, you're blocking on some form of condition, which | will "wake you up" as soon as the condition triggers and you can be | scheduled (and in this "active scheduling" case the time-slice "rule" | doesn't apply). I got out-of-order captured packets on my starfire dual port card ie ack get lower time-stamp than its corresponding seq in tcp traffic. I don't have much nic card level knowledge, so decided to produce delay to send ack and increase it till no out-of-order packet. delay in 1000 micro seconds or above will not let me know the time difference figure. I am also searching for what kind of scheduling this card do in picking the one of buffer by time stamper and for what much time. Where should i look for these info? | | If you give some more info on what you're trying to do (and why you need | such a high resolution sleep), maybe someone will be able to help you | better and show you how to achieve what you're trying to do without | blocking on a timeout. `---- -- Thanks in advance. Sharad Chandra