Keil Logo

Idle Task

When no tasks are ready to run, the RTX kernel executes the idle task with the name os_idle_demon(). By default this task is an empty end-less loop that does nothing. It only waits until another task becomes ready to run.

You may change the code of os_idle_demon() to put the CPU into a power-saving or idle mode. Most RTX_Config.c files define the macro _idle_() that contains the code to put the CPU into a power-saving mode.


/*--------------------------- os_idle_demon ---------------------------------*/

__task void os_idle_demon (void) {
  /* The idle demon is a system task. It is running when no other task is   */
  /* ready to run (idle situation). It must not terminate. Therefore it     */
  /* should contain at least an endless loop.                               */

  for (;;) {
    _idle_();   /* enter low-power mode */


  • On some devices, the IDLE blocks debugging via the JTAG interface. Therefore JTAG debuggers such as ULINK may not work when you are using CPU power-saving modes.
  • For using power-saving modes, some devices may require additional configuration (such as clock configuration settings).

Related Knowledgebase Articles

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.