Visiting the idle-task performance again

hermarcel wrote on Sunday, March 20, 2005:

Yes, you got mypoint :slight_smile:

And I do agree (up to some point) that it is application-specific. But I wouldlike to write my port as a general-use RTOS and therefore do not like to modify default RTOS-files.

Regarding the options you gave:
Setting X to ahigher priority than IDLE is only possible when there are no tasks being deleted in the system.

Implementing X as part of IDLE would a good solution, but contradicts my desire to have the default RTOS-files untouched. And X wouldn’t “look” like an independant task anymore. (unable to kill, change priorities, etc).

Therefore I came up with a third possibility:
Have IDLE execute this pseudo-code during it’s loop:

<code>
if (there is a task on the readylist for IDLE-priority) && (this task != IDLE) {
  yield();
}
</code>

This way IDLE will do just one iteration before giving the cpu back to a waiting task or IDLE loops just like it does now until the end of it’s slice or until some external interrupt.