When we turn on the computer and do not use it, is the CPU idle? When we clicked on a program, how quickly did the computer react? As we all know, CPU is a computer's central processing unit, CPU is not always on standby? In fact, the CPU idle time is also a task!
The CPU is doing nothing for most of the time. Most technologists know this fact, but we haven't discussed it in detail as to how the CPU switches from idle to working, and then back to idle after it's done.
This mechanism is becoming more and more important to modern processors. One of the goals of today's chip design is to switch the processor to a low-power state as quickly as possible.
Instead of doing nothing, the CPU is running idle tasks (idle tasks).
The overall CPU design is to return to the idle state as quickly as possible after the current operation is completed, but the system must have some way/way to wake the chip and let it focus on something else.
One of the ways is to use the system timer.
One way to prevent the CPU from consuming too much power is to have a longer clock cycle (tick periods). In this way, the CPU needs to spend longer idle time before waking up, then perform basic tasks, then sleep again.
What are idle tasks (idle Task)
An idle task may sound paradoxical, and the key is to understand that since the CPU is energized, it must be constantly running, even if he does nothing.
The corresponding word in philosophy is called "Busy Waiting" (Busy waiting), which essentially allows the CPU to constantly compute a condition to see if it is true.
For Windows running on the x86 chip, this feature is represented as a pause (hlt) instruction that corresponds to the system Idle process of Windows.
Windows calls the idle idle process to run only if a CPU core does not have the appropriate thread to execute.
If you look at the Windows System's Task Manager, you will see that the system Idle process (systems idle processes) displays a higher percentage of CPU usage most of the time. Unlike other processes in the process list, the higher the value of the idle process, the smaller the amount of work that represents the CPU.
The HLT directive is designed to minimize power consumption and to allow the CPU to enter a power-saving mode/state.
The history of HLT
The HLT (pause) instruction has a long history and is implemented on the first 8086 processor, but it is not supported by the early operating system. Old programmers may recall that there was a time when even basic HLT functions were never performed as expected.
Looking back at the overclocking years of the past, the CPU had a basic tool called rain, which was used to increase the idle time of the CPU (and enhance the heat and energy consumption during processing). As time goes on, we can see that hardware manufacturers and software developers are becoming more and more complex.
This is one aspect of Windows 8 innovation--well, essentially trying to innovate--but it produces some strange results. By default it allows longer intervals during processing, but it also causes problems with programs such as Google Chrome that automatically tick the clock frequency (rate) to the minimum allowed by the operating system in order to respond more quickly to user actions.
This bug has been fixed in a newer program, but it may still reduce the battery life of some Windows 8 pcs.
This is indeed a place to adjust the clock cycle, coupled with the support of the system without the crystal timer, so that Microsoft unprepared. In Windows8, the software adjusts the front-end bus speed by mixing the operating system time records, which results in incorrect benchmark tests.
This behavior has been maintained in Windows 10, although it is only a small problem--you have to adjust the clock on the front bus of the system when the operating system produces the wrong results.
Race-to-idle is a key component of the modern CPU architecture, AMD and Intel will release a new generation of products almost every year, and will often introduce updates, perhaps the highest performance only to improve a little, but through better clock gating (clock gating) can significantly improve the energy usage, and faster energy-saving mode switching.