Introduction to hibernation and wake-up of Linux systems

Source: Internet
Author: User
Tags apm

Transferred from: http://blog.csdn.net/haomcu/article/details/7398703

System hangs (Suspend) is a feature of power management (APM&ACPI), which brings great convenience to the user. Linux has a good support for power management in the 2.6 series core, and the following is a discussion of Linux support for system hangs.

There is also a comparison of the Android and Linux kernel support for power management, code-level: Linux Kernel and Android hibernation and wake Up (Chinese version)

One URL is http://blog.csdn.net/hellolwl/article/details/6271207

Linux support for system hangs

Linux also provides support for APM and ACPI, when both are incompatible and only one mechanism works at a time. Because of the superiority of ACPI, Linux now sets ACPI as the default power management scheme. For some older motherboards, if the implementation of ACPI in its BIOS was prior to 2000, then Linux automatically enabled APM (which can be enforced by the core command line parameter Acpi=force). If you have some problems with ACPI support in your motherboard BIOS, you can also use the core command-line parameter Acpi=off to force ACPI to be disabled, so that Linux automatically enables APM power management.

Linux now mainly supports three ACPI power-saving methods:

S1:stopgrant, which is standby (standby) mode. The display automatically loses power, only the host is powered on. You can then hit any key to restore the original state.
S2 S3:str (Suspend to RAM), that is, hangs to memory. The system stores the current information in memory, only a few key components such as memory power, when the computer is in a highly energy-saving state. The system cannot wake from the keyboard at this time. The manual wake-up method can only be done by pressing the power button on the front panel. After waking, the computer reads the information from memory quickly back to its original state.
S4:STD (Suspend to disk), that is, suspend to the hard disk, that is, hibernate. The computer automatically shuts down, the current data is stored on the hard disk before shutting down, and the next time the user presses the key on the computer will not need to start the operating system, directly from the hard disk read data, restore the original state.

The following are the ways to view the core support ACPI scenarios under Linux:

2.4 Cores under:
# Cat/proc/acpi/sleep
S0 S1 S3 S4 S5
2.6 Cores under:
# cat/sys/power/state
Standby MEM Disk

The above output indicates that the core of our system supports three power-saving modes simultaneously.

In the/sys/power directory there is also a file: disk, the contents of the file can be as follows:

Shutdown: Save the System state to disk, let the BIOS shut down the computer, platform: Save the System state to disk, let the BIOS turn off the computer, and light up the suspend light; firmware: Let the BIOS save the system State itself and turn off the computer. Requires the BIOS to have its own pending disk. Most of the work is done by the BIOS and is transparent to the operating system;
Here are some ways to enter these three power-saving modes:
#echo  standby >/sys/power/state----> Suspend (S1) #echo  mem >/sys/power/state----> Suspend to Memory (S3) #echo Shutdown >/sys/power/disk; echo Disk >/sys/power/state----> Suspend to Disk (S4) #echo platform >/sys/power/disk; echo Disk >/sys/power/state

Disk Suspend (STD) under Linux is implemented through the SWSUSP mechanism: After memory is saved in the current state of the system, the memory content is written to the Swap partition (swap). This requires that the swap partition capacity is better than the memory capacity. After the system hangs to disk, the next time you start up, you need to pass the command-line parameter Resume=/dev/hdax (/dev/hdax is the swap partition in the system), so that the system can quickly revert to the shutdown state.

There is also an informal core patch that can be implemented Std:software Suspend 2. The project is a fast-growing project, designed to teach swsusp a number of advantages, but has not yet been integrated into the core of the official release, the implementation of the SWSUSP basically the same way.

Although Linux provides a mechanism for system hangs, performing the above pending operation will not necessarily succeed. On the one hand, these operations require the compatibility of peripheral hardware devices, in addition to BIOS support, which means that the device supports power-saving and restores from power-saving or off-state, and on the other hand, these device drivers must be able to receive supply management instructions. At present, the system hangs the main obstacle is those not too perfect drivers, such as USB, video card, sound card driver.

Of course, now the Linux core support for the system hangs to be improved, mainly in:

    1. SMP systems are not supported.
    2. Large memory (>4G) is not supported.
    3. Many modules in the core need additional support for power management.
    4. The upper-level configuration program is missing.

But you can rest assured that all the problems kernel hackers can solve!

Reference reading:

    1. Http://www.acpi.info:ACPI's official website provides free access to the latest ACPI specifications.
    2. ACPI project sites are supported under Http://acpi.sourceforge.net:Linux. The ACPI version in the official Linux kernel is actually lagging far behind the latest version, since the addition of any new features in the Linux stable version is very cautious. You can download the latest ACPI patches from here.
    3. Linux Core Source code directory: documentation/power/, there are some developers write about power management on Linux implementation of the document.
    4. Http://www.suspend2.net:Software Suspend 2 's official website, another solution for Std.

Introduction to hibernation and wake-up of Linux systems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.