Re: Dynamic Timer

george anzinger (george@mvista.com)
Mon, 17 Jun 2002 15:27:51 -0700


"X.Xiao" wrote:
>
> I have two questions about dynamic timer in Linux:
> 1. Kernel space: After add_timer is used, where is the
> code used to poll the global 'struct timer_list' to
> activate the related functions on time? It's not in
> sched.c, is it in tasklet/bh?

The "code" is in timer.c (same place you found "add_timer())
and is called run_timer_list(). It is called by timer_bh()
also in timer.c, which is scheduled by do_timer() (also in
timer.c) which is called each timer interrupt by code in the
arch/kernel/ area (in i386 it is time.c) which, in turn is
called by the interrupt code.

> 2. User space: is there a way to set a dynamic timer
> in userspace as well, such as create_timer(posix, not
> in Linux)?

The tried and true way is the setitimer() call. The POSIX
calls are also available as a patch from the high-res-timers
project (see signature).

-- 
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/