Hi

On 19-Dec-2001 Nate Villaume wrote:
>       Can someone tell me the difference between periodic and one-shot
>       timers?
I think I can. Please correct me if I am wrong.

Periodic timers are configured once and then run periodically, e.g. once
every 10ms. One-shot timers are configured and then run only once, e.g. 20ms
after they were started.

One-shot timers are more flexible than periodic timers, but have more
overhead.

Example 1:
You want to run your scheduler regularly (once at the end of each
time slice). This is a typical periodic task. You can use a normal periodic
timer, configure it once, and you're done.
If you want to do the same with a one-shot timer, you need to configure this
timer again and again once for every timeslice (each timer interrupt can
configure the timer for the next timeslice).

Example 2:
You have a task that wants to sleep for 800�s.
If you have a periodic timer, e.g. running every 10ms, then you will not get
a timerinterrupt until the current timeslice is over. If, accidently, 4ms of
this timeslice are over, you will get the next timerinterrupt in 6ms. This is
much longer than you really wanted to wait. Of course, you can configure your
periodic timer to run once every 200�s, but then you will hardly do anything
else any more (the CPU uses most of its time to handle timerinterrupts).
If you use a one-shot timer, you just configure your timer for 800�s.
You get a timerinterrupt just when you wanted it.

To put it short, with virtual timers you usually can achieve a much higher
(virtual) resolution.

Bye,
Wolfgang

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to