Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Oct 2008 11:55:15 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        sandiegobiker@gmail.com
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Polling and Sleep in a Driver
Message-ID:  <20081019.115515.-1350513661.imp@bsdimp.com>
In-Reply-To: <27cb3ada0810190720u2cc84097w2ed6425bc6ee8d3f@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

In message: <27cb3ada0810190720u2cc84097w2ed6425bc6ee8d3f@mail.gmail.com>
            "Len Gross" <sandiegobiker@gmail.com> writes:
: I have a MAC protocol written using Netgraph.   It runs in userland
: and uses a simple poll, sleep loop.  It has proved that the algorithms
: are correct, but the sleeps are not regular/accurate enough for my
: purposes.  (I have pushed Hz up quite a bit with no real effect)

This surprises me.  I've seen big effects going from 100Hz to 1000Hz.

: If I were to implement the algorithms within a driver would the sleeps
: still suffer from the same "non real-time" behaviour I see in
: userland?

Well, it depends on what you are seeing.  How accurate a sleep do you
need?  I've discovered that 2 / HZ is a good lower bound for sleep
inaccuracy in the kernel.  Often times this won't matter.  You may be
able to push the bounds with some clever hacks, but it still won't get
you below 1/Hz w/o some other interrupt source that can clock a higher
res timer.

Warner


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081019.115515.-1350513661.imp>