v01d opened a new issue #1733:
URL: https://github.com/apache/incubator-nuttx/issues/1733
When NuttX is configure in tickless mode, the scheduling timer will continue
to run even when there is a single task and no timeouts are pending. This means
that unless the processor goes to sleep (thus disabling the timer), in some
cases this interrupt can unnecessarily burden de processor which may be
important in very low power applications.
This scheduling timer is currently triggered due to a "hack" which is
documented as:
<pre>
/* In the original design, it was planned that nxsched_reassess_timer() be
* called whenever there was a change at the head of the ready-to-run
* list. That call was intended to establish a new time-slice or to
* stop an old time-slice timer. However, it turns out that that
* solution is too fragile: The system is too vulnerable at the time
* that the ready-to-run list is modified in order to muck with timers.
*
* The kludge/work-around is simple to keep the timer running all of the
* time with an interval of no more than the timeslice interval. If we
* do this, then there is really no need to do anything when on context
* switches.
*/
#define KEEP_ALIVE_HACK 1
</pre>
Some extra explanation from Greg:
> Use of almost all internal OS interfaces require that the OS data
structures always be in the correct state. During a context switch that
internal state for one task is torn down and the new state for the news task is
set up. In between those times, the OS is in an indeterminate state and the use
of any OS internal interface (such as the timer interface) may not be reliable.
>
> I don't recall the specific issue that I faced when I wrote that
comment, but I do remember that there was no simple work-around. It is,
however, certainly worth revisiting if someone is motivated to really dig into
the guts of the OS.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]