Usually I would stuff my laptop straight into my school bag when I left work. Sometimes I’d get it out when I got home and find it very hot, giving me the impression that the computer kept running even after the lid was closed, so I spent time researching the sleep and hibernation mechanisms under Windows.

The official description of sleep and hibernation states


Sleep uses very little power, your computer starts up faster and you can immediately return to where you left off. There is no need to worry about losing work due to a drained battery, as Windows automatically saves all work and shuts down your computer if the power is low. Use Sleep when you are away from your computer for a short period of time (e.g. to take a break).

For many computers (especially laptops and tablets), the computer goes to sleep when you close the lid or press the power button.

  • To set your computer to go to sleep when you close the lid or press the power button:
  • Select “Search” on the taskbar, type in Control Panel and select it from the results.
  • Select “System and Security”.
  • In the “Power options” section, select “Change power button function”.
  • Select “Change currently unavailable settings”.
  • Select the option according to how you want the “sleep” to work:
    • For laptops, expand the list of covers in the “When I switch off the battery” column and select “Sleep”. If required, repeat the above steps for the “Insert” column.
    • For a desktop, tablet or laptop, expand the list in the “Press power” column when the “Press power” button is pressed, then select “Sleep”. If necessary, repeat the above steps for the “Insert” column.
  • Select “Save changes”.

Once you are ready to put your computer to sleep, simply press the power button on your desktop, tablet or laptop, or close the lid on your laptop.

On most computers, you can resume work by pressing the computer’s power button. However, not all computers are the same. You may be able to wake it up by pressing any key on the keyboard, clicking the mouse button or opening the lid on your laptop. Please check the documentation that came with your computer or go to the manufacturer’s website.


This option is designed for laptops and may not be available for all computers. (For example, computers with InstantGo do not have a hibernate option.) The Hibernate option uses less power than the Sleep option and when you start your computer again you can return to where you left off before (although not as fast as the Sleep option).

If you know you won’t be using your laptop or tablet for a long time and it is unlikely that you will be able to charge the battery during that time, then use the hibernate option. First, check that your computer offers this option and if it does, turn it on.

To set your computer so that it sleeps:

  • Select “Search” on the taskbar, type in Control Panel and select it from the results.
  • Select “System and Security”.
  • In the “Power Options” section, select “Change power button function”.
  • Select “Change settings that are currently unavailable”.
  • In the “Off settings” section, select “Hibernate”.
  • Select “Save changes”.

You are now able to put your computer to sleep in a number of different ways:

  • Select “Start” and then “Power > Hibernate”.
  • Press the Windows logo key + X and select “Shutdown” or “Logout” > Hibernate.

After reading the above paragraph, I found that I had not read it and did not understand the logic behind it, so I searched for the Mac OS sleep mechanism.

Mac OS’s sleep mechanism

The Mac OS sleep mechanism is a power-saving mode used to allow the computer to hibernate when not in use to save energy. When Mac OS goes to sleep, it automatically suspends all activity and saves the data in memory to the hard disk so that when the computer is woken up it can resume its previous state. The following are the Mac OS sleep mechanisms:

In Mac OS, you can adjust sleep settings via System Preferences in the Apple menu. You can choose when to enable sleep mode, hibernate mode or deep sleep mode and when to activate these modes.

Select Apple menu > System Preferences and then tap Energy saving.

Do one of the following:

  • Set the amount of time the computer or monitor will wait before going to sleep: drag the “Computer goes to sleep” and “Monitor goes to sleep” sliders, or the “Turn off monitor after this time period “slider.
  • Prevent the Mac from automatically going to sleep: Select “Prevent the computer from automatically going to sleep when the monitor is turned off”.
  • Put the hard drive to sleep: Select “If possible, put the hard drive to sleep”.

One note: macOS sleeps by default, turning off the screen but maintaining the power used for memory (RAM). This allows macOS to resume as soon as the lid is opened. If the battery level falls below some preset threshold, the data in memory is dumped to the hard drive and the power is then completely cut off.

There are two states of macOS sleep

  • The power is constantly on and data is stored in memory for quick recovery. We call this state Sleep.
  • Power is off, data is stored on the hard drive, and recovery is slow. We call this state Sleep (Hibernate/Stand-by)

Sleep and hibernate can be combined in three modes, controlled by hibernatemode

  • hibernatemode = 0, which is the default value for desktop devices. The system only sleeps, it does not hibernate and does not store data on the hard disk.
  • hibernatemode = 3, which is the default value for mobile devices. The system sleeps by default, stores data on the hard disk after a certain period of time or when the power level falls below a threshold, and then hibernates. This is the so-called Safe-Sleep.
  • hibernatemode = 25. hibernate only, no sleep.

When resuming from disk in either safe sleep mode or hibernate mode, it will take a certain amount of time (tested, about 3 seconds) before the screen will light up.

For hibernatemode = 3, the safe sleep mode, there are a few more parameters to control the details.

  • When the remaining power is greater than highstandbythreshold (default 50%), it goes to sleep after standbydelayhigh seconds (default 86,400, i.e. a full day).
  • When the remaining charge is less than highstandbythreshold, it goes to sleep after standbydelaylow seconds (default 10,800, i.e. three hours).

Exploring the principles: the technology behind sleep, hibernation shutdown

ACPI (Advanced Configuration and Power Interface) is a power management protocol designed to provide a unified interface between computer operating systems and hardware devices to enable efficient power management functions.

The ACPI protocol was originally developed by companies such as Intel, Microsoft and Toshiba to replace older power management standards such as AT (Advanced Technology) and ATX (Advanced Technology Extended).

The main objectives of ACPI are to achieve the following functions:

  • Power management: ACPI allows the operating system to efficiently manage the computer’s power supply. It provides a standard set of interfaces that allow the operating system to control and manage the power state of the computer, including hibernation, sleep, standby and other modes.
  • Hardware configuration: ACPI provides a mechanism that allows the operating system to detect and configure the hardware devices in the computer. Through ACPI, the operating system can obtain information about the device, such as sensor data, battery status, etc., and perform the necessary configuration and management.
  • System event handling: ACPI defines a set of event models for handling various events that occur in the system, such as keystrokes, power state changes, temperature changes, etc. The operating system can take action based on these events, such as initiating specific operations or triggering appropriate notifications.
  • Performance management: ACPI also supports performance management functions such as dynamic frequency tuning and power consumption management. By adjusting the operating frequency and power consumption of hardware devices, ACPI can optimise the performance and energy efficiency of the system.

ACPI uses a data structure called an ACPI table to describe the system’s power and configuration information. These tables are located in the computer’s BIOS (Basic Input/Output System) and are read and interpreted by the operating system during the boot process. The operating system uses the ACPI tables to understand hardware configuration and power management related information and to act accordingly as required.

In summary, ACPI is an important power management protocol that provides a unified interface between operating systems and hardware devices for efficient power management and hardware configuration. It provides a standardised approach that enables computers and operating systems from different vendors to achieve compatibility and interoperability in terms of power management.

ACPI (Advanced Configuration and Power Interface) has been updated since 1997 when Intel, Microsoft and Toshiba worked together to develop this standard, all the way up to the current ACPI 6.3. ACPI provides the hardware abstractions and interfaces (methods) available to the OS. Prior to this, Advanced Power Management (APM) left power management almost entirely to the BIOS, which was stale and restrictive. Simply understood, ACPI is a bridge between the laptop hardware and the operating system, helping the operating system to understand the state of the computer hardware and enabling the operating system to control the machine hardware in order to achieve control between various hardware and software. Through the ACPI protocol, we can control a series of settings such as power on/off/keyboard functions/fan speed/power consumption with the computer software. Simply understood, ACPI consists of two main parts:

  • Form Tables that tell the current hardware status of the system
  • AML program code that provides the operating system call interface method

For the first decade or so of the PC’s existence, the focus was mainly on improving performance rather than saving power. It was only after the advent of portable devices such as notebooks that consideration began to be given to ways of saving power in order to extend the time the battery could be powered, so that various power-saving states were invented, and the ACPI standard encapsulates these inventions, including S1, S3 and S4 at the system level; C0/C1/C2/C3 at the CPU level; D0/D1/D3 at the device level, and so on.


[Sleep states S0-S5] for system power management within the ACPI.

ACPI: Sleep states S0-S5

  • S0 (G0) Normal (on)
    • Machine is running normally
  • S1 - Standby (Sleep 1)
    • The system is in a low power supply state, the CPU stops working, the screen does not output a screen, the memory hard disk standsby, the power light flashes
    • At this time, moving the mouse or pressing any key on the keyboard will wake up the computer
  • S2 - Power Standby (Sleep 2)
    • Almost the same condition as S1, the difference is that the CPU has been shut down.
    • Move the mouse or press any key on the keyboard to wake up the computer
  • S3 – Suspend to RAM (Sleep 3) (usual)
    • CPU/GPU/hard disk/fan all stop working
    • Memory is powered on and information is stored in memory
    • Moving the mouse, pressing any key on the keyboard at this point will wake up the computer (will be slower than standby)
  • S4 - Suspend to Disk (hibernate)
    • All devices CPU/GPU/hard disk/fan/memory/hard disk will stop working
    • A copy of the information in the memory will be saved to the hard disk
    • At this point, moving the mouse or pressing any key on the keyboard will wake up the computer (it will be slower than standby)
    • At this point, it is equivalent to restarting the computer, but the memory reads the previously retained memory data, the more memory before hibernation, the slower the hibernation state starts
  • S5 - Shutdown (shutdown)
    • Power off
    • Next boot, reload OS

The sleep modes supported by the computer can be viewed with the following command:

(base) PS C:\Users\biaod> powercfg /a
    待机 (S0 低电量待机) 连接的网络

    待机 (S1)
        当支持 S0 低电量待机时,禁用此待机状态。

    待机 (S2)
        当支持 S0 低电量待机时,禁用此待机状态。

    待机 (S3)
        当支持 S0 低电量待机时,禁用此待机状态。



The confusing Modern Standby

S0ix is also known as S0 Low Power Idle. Microsoft calls this “modern standby”. This is a state where the processor is running at low power and can maintain a network connection.

“Modern Standby”, which is actually about ten years old, has had a very difficult journey. Along with its rocky fortunes was its name, at the beginning it was called Instant-on, when Windows 8 came out it was called Connected Standby, then it was renamed InstantGo, and in Windows 10, for the sake of inclusivity, it was renamed Modern Standby (Modern Standby), containing both Connected Standby and Disconnected Standby modes. For CPU and BIOS firmware engineers it is called S0ix, while for device manufacturers and firmware it is closely related to RTD3 (Runtime D3).

Apple’s iPhone ushered in the era of mobile internet. One of the key features of the iPhone when it was launched was the ability to receive push messages etc. when the screen was locked. Seeing that mobile devices were a big seller, the two brothers, Windows and Intel, also wanted a piece of the action and were moving into smartphones as well. The idea was that they could seamlessly import the huge number of Wintel users into the Windows Phone market, and while CPU performance was certainly not a problem, one of the immediate challenges was power consumption. For this reason the instruction set and pipeline were neutered and the Atom series of CPUs were customised, but the problem was not completely solved.

The iPhone hardly ever turns off the phone for anyone, pressing the power button just turns off the screen, important text messages and push messages are received and alerted, people press the button when they want to use the phone and the screen lights up immediately without waiting. Anyone who expects users to put up with a new phone that turns completely wooden when they press the power button and takes a second to respond when they want to use it must be crazy. s3 sleep does not satisfy customers, but just turning off the screen and letting the CPU go to C2 or C3, which consumes much more power than the ARM camp, is not an option either.

The deepest C State just puts the CPU core part into a state where power consumption is almost zero, while the uncore/SA/NorthComplex part of the CPU continues to work (improved by the recent UFS), and to make matters worse the PCH (SouthComplex) and the rest of the chips on the motherboard are also working at full power and contributing their own power consumption without complaint.

Most phones in the ARM camp consume only a few milliwatts in standby, while new Wintel prototypes consume hundreds of milliwatts in standby. How to fill this huge black hole became a problem that Microsoft and Intel engineers had to solve.

In order to rival the features of the ARM camp, Wintel has come up with the Instant On/Off (Connected Standby) technology together. As the name suggests, this technology requires the screen to light up and the system to be available as soon as the power button is pressed, while at the same time requiring the system to be in Standby mode, essential devices such as network communication must be able to wake up the device to keep communication notifications etc. open. The strange combination of the system booting up in 0 seconds and remaining available, requiring that it must be S0 on, while at the same time requiring standby power consumption to be in the order of a few milliwatts, roughly the power consumption of S3, is what is known as S0ix.

In order to achieve this goal, a great deal of effort has been put into making changes from hardware to software. We all know that just gating the clock can reduce power consumption, but to achieve 0 power consumption, the power input must be turned off, that is, to Power Gating. and turn off the power, it means that the chip inside the state machine all reset. The rough understanding is that the registers and so on all clear 0, to restore available, must re-initialize the registers, this is the S3 back when the BIOS in that 1 second mainly do things. And now it is required that there cannot be this 1 second, so the register content or state machine state cannot be lost, how to do it?

It is only up to the chip to remember its own state. The chip’s internal power management module will follow the steps, step by step, to turn off the chip’s internal areas (S0->S0i1->S0i2->S0i3), and save the registers/status in the internal nvram, and cut off the power supply to these areas, so that its power consumption is close to 0; when it comes to recovery, it will do the opposite, step by step, to recover the registers. It’s the equivalent of taking a snapshot and restoring it back later. As this process is done in hardware, it is very fast.

For devices external to the chip, devices that do not require notification are to enter the D3 cold state with a power consumption of 0. This is typically done by the BIOS reporting ACPI, which operates the GPIO to turn off the device’s power rail. for devices that need to wake up, a state called Runtime D3 (RTD3) must be supported to offload information to that device for processing, and to The CPU and other devices in low power are woken up only when necessary.

One of Microsoft’s more confusing operations in recent years has been the forced push of S0ix standby mode, presumably with the aim of turning computers into something similar to phones and tablets, able to receive news pushes in real time (at this glance it is clear that this was a misguided idea put forward by Microsoft in the Windows 8 era, in fact most people now have a mobile phone and the ability to receive new news pushes in real time has been completely replaced by mobile phones). Pushing S0ix was a big mistake on Microsoft’s part. x86 processors, even in low power mode, consume power that cannot be ignored, so the observable power drain in S0ix standby mode is going to be there. However the bigger problem is wake-up. In S0ix state the system can be woken up not only by user input, but also by timers or even network packets. Secondly many things may also prevent the system from going into low power mode. If something goes wrong with the above, one possible result is that the computer never goes to sleep. Of course, such anomalies will appear less and less often in newer hardware and Windows versions. In contrast, with the S3, the CPU, which is a major power consumer, stops working altogether and there is basically no power consumption problem. Memory data retention allows the computer to wake up relatively quickly compared to the S4, making it a very desirable sleep mode.

Newer versions of Windows can force S3 on with the following command:

reg add HKLM\System\CurrentControlSet\Control\Power /v PlatformAoAcOverride /t REG_DWORD /d 0

Restore S0 standby.:

reg delete "HKLM\System\CurrentControlSet\Control\Power" /v PlatformAoAcOverride