CPU_IDLE(9) BSD Kernel Developer's Manual CPU_IDLE(9)
cpu_idle -- idle CPU while waiting for work
The cpu_idle() function is invoked to idle the current CPU while waiting
for work to be done. It is primarily called by the scheduler if no pro-
cesses are available on the system run queue. The cpu_idle() function is
a machine-dependent implementations in order to permit low-level CPU con-
The cpu_idle() function must be called with the scheduler lock held and
at the splsched(9) interrupt protection level. It performs the following
o Release the scheduler lock.
o Lower the current interrupt priority level to permit interrupts to be
taken that will eventually cause processes to appear again on the
system run queue.
o Try to zero some pages for the virtual memory system.
o Perform any CPU or system power control.
o Wait until a process appears on the system run queue.
o Acquire the scheduler lock.
For CPUs which don't support an idle operation, the CPU must spin until a
process appears on the system run queue. Generally, this is done by
checking if the sched_whichqs variable in the scheduler is not zero. See
setrunqueue(9) for further details.
mi_switch(9), scheduler(9), setrunqueue(9), spl(9), uvm(9)
BSD September 21, 2002 BSD