[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timed routines



I'd like to propose a change to the way RTEMS handles timers.
  
Although it's not really mentioned in the documentation (at least not
anywhere that I could find), timed routines run in the context of the
clock interrupt service routine.  I propose changing this so that timed
routines run in the context of a timer task.  The clock interrupt
handler (rtems_tick_handler) would then update the time value and send
an event to the timer task which would do the callouts to the timed
entries.

For example, the _Watchdog_Tickle_ticks routine could decrement a
`ticks-till-next-timed-entry' counter and send an event to the timer
task when the counter reached 0.  The timer task would then reset the
`ticks-till-next-timed-entry' counter and perform the required
callbacks.

There would be two more configuration parameters associated with the new
scheme.
1) The priority at which the timer task would run (perhaps 1 or 2 by
default)
2) The stack size of the timer task.

Good things resulting from the change:
        Interrupt latency would be reduced since the processor would
        spend less time in the clock interrupt handler.
        Timed routines would be able to call on any service, including
	network I/O.

Bad things:
	Somewhat more overhead in processing timed routines.  The overhead
wouldn't
	be that high, though, since the event would be sent to activate the
timer
	task only when a callout was due.

-- 
Eric Norum                                 eric at cls.usask.ca
Canadian Light Source                      Phone: (306) 966-6308
University of Saskatchewan                 FAX:   (306) 966-6058
Saskatoon, Canada.