Date: Mon, 25 Feb 2008 16:15:02 +0530 From: Sharad Chandra <sharadc@in.niksun.com> To: freebsd-hackers@freebsd.org Cc: "Heiko Wundram \(Beenic\)" <wundram@beenic.net> Subject: Re: usleep Message-ID: <200802251615.03040.sharadc@in.niksun.com> In-Reply-To: <200802251039.59767.wundram@beenic.net> References: <200802221558.42443.sharadc@in.niksun.com> <200802251440.56435.sharadc@in.niksun.com> <200802251039.59767.wundram@beenic.net>
next in thread | previous in thread | raw e-mail | index | archive | help
,---- [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802251615.03040.sharadc>