0
void cpu_idle (void)
{
    /* endless idle loop with no priority at all */

    while (1) {
        void (*idle)(void) = pm_idle;
        if (!idle)
            idle = default_idle;
        if (!current->need_resched)
            idle();
        schedule();
        check_pgt_cache();
    }
}

this code existed in : "arch/i386/kernel/process.c" related to linux 2.4.18-14

this code is responsable of the ( cpu idle loop ).

the question is : can I change the while(1) loop with bust wait ?

  • please edit you question to include the code rather than a screenshot – Noam Hacker May 03 '16 at 14:52
  • Presumaby, 'pm_idle' exists so that you can 'override' the default idle handler function, something that probably halts the calling processor core. Presumably, you could point 'pm_wait' at a function that does nothing except return, and cpu_idle would then warm up the room by continually calling 'schedule' and 'check_pgt_cache'. Even if that 'works', why anyone would want to do this is beyond me:( – Martin James May 03 '16 at 18:30

1 Answers1

1

The loop here properly schedules processes so the system continues to run properly. Switching to a pure busy wait would lock up the system when the cpu goes idle, meaning other processes would cease to be scheduled. You definitely do not want that.

bodangly
  • 2,473
  • 17
  • 28