regarding timeout/untimeout kernel functions
Peter Jeremy
PeterJeremy at optushome.com.au
Fri Jul 23 14:13:47 PDT 2004
[Please wrap your mail before 80 columns]
On Thu, 2004-Jul-22 17:59:40 -0700, pradeep reddy punnam wrote:
> i am working on a project , where i came across a
>situation where i need to execute a function when a timer expires
>,exactly similar to functionality of the timeout() kernel function
How about setitimer(2) and a SIGALRM handler?
>but i need this in userland(application), and the execution of the
>function is time sensitive, it should be run immediately when timer
>expires.
What is your definition of "immediately"? Timeouts are rounded to
ticks (and FreeBSD has a 1-2 tick slop for various reasons). Once the
(rounded) timeout expires, then it's up to the scheduler to actually
invoke your timer handler function in line with normal scheduling
rules. Overall, it's unlikely that your handler will get called early
but it will typically be called about 1 tick late (and there's no
upper bound on how late your handler will be invoked if the system is
heavily loaded).
--
Peter Jeremy
More information about the freebsd-hackers
mailing list