照片由Asif A. Ali（Flickr）提供。
Suppose you have a Windows operating system installed on your computer and you toggle the system into sleep mode before putting it away. To the best of my knowledge, there would be no programs or processes running. Would the processor still be running or active in the background in some manner or capacity and utilizing power?
When you perform any action with modern computers running Windows 7, 8.1, or 10 (i.e. opening the lid, pressing a button, touching the mouse), it immediately turns itself on without having to press the power button. Is it because the CPU was actively waiting for those events to occur while in low power mode?
Is a CPU Active in Sleep Mode?
It depends. There are different sleep states (S1 to S4) and the CPU state is not the same in all of them.
- The CPU is stopped in sleep state S1
- The CPU is powered off in sleep states S2 or greater
Sleep is normally sleep state S3, but the BIOS can sometimes be configured to use sleep state S1 instead (used when resume from S3 does not work properly).
- powercfg -a (can be used to see what sleep states a PC supports)
System Sleep States
States S1, S2, S3, and S4 are the sleeping states. A system in one of these states is not performing any computational tasks and appears to be off. Unlike a system in the shutdown state (S5), however, a sleeping system retains memory state, either in the hardware or on disk. The operating system need not be rebooted to return the computer to a working state.
Some devices can wake the system from a sleeping state when certain events occur, such as an incoming call to a modem. In addition, on some computers, an external indicator tells the user that the system is merely sleeping.
With each successive sleep state, S1 to S4, more of the computer is shut down. All ACPI-compliant computers shut off their processor clocks at S1 and lose system hardware context at S4 (unless a hibernate file is written before shutdown), as listed in the sections below. Details of the intermediate sleep states can vary depending on how the manufacturer has designed the machine. For example, on some machines certain chips on the motherboard might lose power at S3, while on others such chips retain power until S4. Furthermore, some devices might be able to wake the system only from S1 and not from deeper sleep states.
System Power State S1
System power state S1 is a sleeping state with the following characteristics:
- Less consumption than in S0 and greater than in the other sleep states, processor clock is off and bus clocks are stopped, software resumption
- Control restarts where it left off
- Typically no more than two seconds
System Hardware Context
- All context retained and maintained by hardware
System Power State S2
System power state S2 is similar to S1 except that the CPU context and contents of the system cache are lost because the processor loses power. State S2 has the following characteristics:
- Less consumption than in state S1 and greater than in S3, processor is off, bus clocks are stopped (some buses might lose power), software resumption
- After wake-up, control starts from the processor’s reset vector
- Two seconds or more, greater than or equal to the latency for S1
System Hardware Context
- CPU context and system cache contents are lost
System Power State S3
System power state S3 is a sleeping state with the following characteristics:
- Less consumption than in state S2, processor is off and some chips on the motherboard might also be off
- After the wake-up event, control starts from the processor’s reset vector
- Almost indistinguishable from S2
System Hardware Context
- Only system memory is retained; CPU context, cache contents, and chipset context are lost
System Power State S4
System power state S4, the hibernate state, is the lowest-powered sleeping state and has the longest wake-up latency. To reduce power consumption to a minimum, the hardware powers off all devices. Operating system context, however, is maintained in a hibernate file (an image of memory) that the system writes to disk before entering the S4 state. Upon restart, the loader reads this file and jumps to the system’s previous, pre-hibernation location.
If a computer in state S1, S2, or S3 loses all AC or battery power, it loses system hardware context and therefore must reboot to return to S0. A computer in state S4, however, can restart from its previous location even after it loses AC or battery power because operating system context is retained in the hibernate file. A computer in the hibernate state uses no power (with the possible exception of trickle current).
System power state S4 has the following characteristics:
- Off, except for trickle current to the power button and similar devices, software resumption
- System restarts from the saved hibernate file. If the hibernate file cannot be loaded, rebooting is required. Reconfiguring the hardware while the system is in the S4 state might result in changes that prevent the hibernate file from loading correctly.
- Long and undefined. Only physical interaction returns the system to a working state. Such interaction might include the user pressing the ON switch or, if the appropriate hardware is present and wake-up is enabled, an incoming ring for the modem or activity on a LAN. The machine can also awaken from a resume timer if the hardware supports it. System hardware context.
- None retained in hardware. The system writes an image of memory in the hibernate file before powering down. When the operating system is loaded, it reads this file and jumps to its previous location.
Source: System Sleeping States
- An A-Z Index of the Windows CMD Command Line – An excellent reference for all things Windows command line related.
- powercfg – Control power settings and configure Hibernate/Standby modes.