[coyotos-dev] Input requested: interval timing
Jonathan S. Shapiro
shap at eros-os.com
Fri Sep 14 13:25:54 EDT 2007
I would like some input from people who know more about real-time than I
do. I suspect I know the answer, but it never hurts to ask for input on
these things.
There are two styles (perhaps I should say "usage models") for interval
timers: the tick counter approach and the programmed interval approach.
In the tick counter approach, the timer is free-running and interrupts
at regular intervals (in old UNIX: every 60 hz). Advantages:
1. Reprogramming older timers takes a while, so you have
lower cost there.
2. Kernel doesn't need a terribly fa
Disadvantages:
1. You are stuck with whatever period you set up on that timer, which
is invariably either too small or too large, but never just right.
To do a good job with real time, you need to run the timer fairly
fast, but that means you get a lot of interrupts where there is
basically nothing to do.
In the interval approach, you program the counter in "one shot" mode
according to when the next timed event should occur. Advantages:
1. Greater flexibility of configuration.
2. No "useless" interrupts.
Disadvantages:
1. Re-programming every time carries overhead.
2. Supporting legacy OS semantics (UNIX) tends to force
you to run a tick counter anyway so that you can
emulate the old behavior. This can be built on top of
a one-shot model.
My intuition is that we should use the one-shot approach for now.
Reactions?
shap
--
Jonathan S. Shapiro
Managing Director
The EROS Group, LLC
www.coyotos.org, www.eros-os.org
More information about the coyotos-dev
mailing list