Is the CPU active in Sleep mode?
Is 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 state S2 or greater.
Sleep is normally sleep state S3 but the BIOS can be sometimes configured to use sleep state S1 instead (used when resume from S3 doesn't work properly).
powercfg -a
can be used to see what sleep states a PC supports.
Example output:
F:\test>powercfg -a
The following sleep states are available on this system:
Standby (S3) Hibernate Hybrid Sleep
The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.
Standby (S2)
The system firmware does not support this standby state.
System Sleeping 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 the 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, from 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.
Hardware latency
- 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.
Hardware latency
- 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 also might be off.
Software resumption
- After the wake-up event, control starts from the processor's reset vector.
Hardware latency
- 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, prehibernation 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 battery or AC 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).
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.
Hardware latency
Long and undefined. Only physical interaction returns the system to the 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
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- powercfg - Control power settings, configure Hibernate/Standby modes.
David's excellent answer is correct for traditional machines, and Windows versions prior to 8. However, Windows 8 introduced a new sleep mode for low power devices (Atom-based tablets, etc..) This is known as InstantGo/Connected Standby. This is the default "sleep" mode when you turn off the screen on a Windows tablet with supported hardware.
Connected Standby does not use the traditional ACPI sleep states. Its goal is to keep connectivity peripherals active, allowing the OS to respond to notifications, e.g. an incoming email, instant message, etc.. Additionally, the machine "wakes up" for a couple hundred milliseconds every 30 seconds. The CPU should respond (wake up) faster than it would from a traditional S3 sleep.
[Connected Standby requires] The capability to switch between idle and active modes in less than 100 milliseconds. The active mode allows code to run on the CPU(s), but does not necessarily allow accessing the storage device or other host controllers or peripherals. The idle mode can be a clock-gated or power-gated state, but should be the state that has the lowest power consumption for the SoC and DRAM.
source
Note that this is much, much faster than the up to two seconds specified for S1, or the two seconds or more for S2/S3, as in David's answer.
To this end, the CPU is kept in a special state Microsoft calls DRIPS (Deepest Runtime Idle Platform State) on supported hardware.
On Intel (x86) SoCs, this falls under one of the new (non-standard) S0ix states, specifically S0i3. In this state, the CPU does not execute any code, but the SoC as a whole is still active enough to remain connected to the network and respond to any events.
As far as ACPI is concerned, this is still considered the S0 (active) state. Windows uses the ACPI_S0_LOW_POWER_IDLE
flag to determine if the DRIPS is supported. The ACPI specification (6.0, April 2015, §5.2.9, table 5-35, pg. 127) defines this flag as:
A one informs OSPM that the platform is able to achieve power savings in S0 similar to or better than those typically achieved in S3. In effect, when this bit is set it indicates that the system will achieve no power benefit by making a sleep transition to S3.
According to Microsoft:
Systems that support Modern Standby do not use S1-S3.
There are many types of standby modes managed by ACPI https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface
CPU is usually running when in standby mode, although with a low clock rate - it listens to only specific inputs and does not actively run any other process. I have tried measuring it first by running procmon and setting laptop to sleep, but it didn't run at all for this period.
There are 4 global states, G0-G3, where G0 is Running and G3 is Mechanical off According to the article linked, G1 substate S2 turns off CPU and moves it's cache to RAM. RAM is the one that is powered on in all types of sleep - it is powered off in hibernation and in standard shutdown. In most sleep states, all external input devices are powered on and will send wakeup events to the computer. Computer can also wake up itself to process routines that require wake up calls.