[En-Nut-Discussion] Timers running slow
Dusan Ferbas
dferbas at etech.cz
Fri Apr 28 23:55:44 CEST 2006
Hi Harald,
sorry for not taking part in that timer callback discussion.
8 years ago I solved problem with undeterministic context during
timer interrupt in a following way:
In timer interrupt, only counter was incremented to leave as much as
possible from time slice for non interrupt state to run. OS was(is)
round-robin, cooperative, without priorities. Timer task was waked up
and was inserted into the front of run queue. So it behaves like
highest priority task. Note: there is a two way linked list
implementation of queues which allows to move from one (dormant)
queue into another one (run) with 2 C lines (I think that they
represents 6 instructions on Freescale).
This approach brought incredible stability (threads were allowed to
overlap OS tick slice), timer callbacks run on defined stack (1
disadvantage is that same stack size is for all callback routines)
AND for longer period (than 1 tick slice), time is accurate.
At 12:00 28.4.2006, you wrote:
>Timer callbacks are deprecated. There had been several discussions,
>wether we should completely remove them. They are running in
>interrupt context and may spoil the real time behavior. Instead
>of removing them, we decided to execute timer callbacks during
>context switches. This provides some backward compatibility, but
>the exact timing is lost.
>
>You should use timer interrupts in your application instead.
>Timer 0 is reserved for Nut/OS, all other timers may be freely
>used by your application.
>
>Sorry for any outdated documentation, which may have mislead you.
>
>Harald
Dusan
More information about the En-Nut-Discussion
mailing list