Linux power Management (2) _generic pm Basic concepts and software architecture (Volute technology, www.wowotech.net)

Source: Internet
Author: User

1. Preface

Here generic PM, is the name of the snail, refers to the Linux system of the regular power management means, including shutdown (power off), standby (Standby or Hibernate), restart (Reboot) and so on. These tools are used in the PC or server era before embedded Linux is popularized. In the wild days of computer science, human beings, stimulated by Moore's law, diligently pursued the computing power and processing performance of computers, so they were not particularly concerned about power consumption.

In this context, the development of Linux power Management mechanism, are extensive, static, passive, please refer to the following introduction.

2. Generic pm in Linux operating system representation

Linux operating system, and generic PM related operations such as the following image:

This image captures the "Linux Ubuntu 2.6.32-38" System from the Volute, which consists of 3 parts:

The 1th part is the system shutdown, restart and other operating interface, including Hibernate, Restart, shutdown three operation options;

2, 3 is the "Power Management properties" setting, so-called power management properties, you can configure the system in different power modes (such as AC power, battery, etc., because the spiral machine is a PC, so there is no battery-powered option), in the inactive state, how long after The system shuts down display, or enters the sleep state.

This article will focus on the various nouns mentioned above, describing their meanings and how they are implemented in the kernel. Before you begin, explain the meaning of these words.

Shutdown, very good understanding, is the meaning of the shutdown. It also means that the computer is no longer used.

Restart, also very well understood, is the meaning of rebooting the system. Restart the process, no longer use the computer.

Hibernate, which can be translated into hibernation.

Hear the word "hibernate", do you have a light? Scroll in the "Linux Power Management (1) _ Overall architecture," explained the concept of power management, mentioned, animal hibernation is the nature of the design of a power management method. in the animal kingdom, hibernation refers to the physiological state in which animals (usually for warm-blooded animal) enter in a manner that lowers their body temperature, in which less energy is required to achieve energy-saving purposes.

And in the computer world, designers have borrowed the concept of "hibernation", and when they don't need a computer, save all of their current live (executed programs, display images, playing sounds, etc.) to some memory (such as a hard drive) where power is not lost, and then turn off the computer. Upon re-opening, the system will read and recover the field from the memory before it is closed, and from the user's point of view, the computer will be as if it had not been closed.

If the computer field of "hibernation" moved to the animal kingdom, it would be such a scene: A dinosaur, walking the eight-step, eating bananas, dangling leisurely walk in the woods. Then, the bored sun Monkey came, shouted a "definite!" "That's where the dinosaurs were set." Then, 10,000 years later, the Bored Sun monkey came again, shouted "Move!" "The dinosaurs continued to step on their feet, eating bananas as if nothing had happened."

Sleep, sleeping. The word is also learned from the biological world. Imagine the difference between "sleep" and "hibernation"? Sleep is light and you can wake up at any time. In a computer, Hibernate needs to save the field to a memory that is not lost in power outages and read it back when it wakes up, which can take a long time (because the power outage does not lose memory access is slower). If you want to hurry, save the scene in memory, this is sleep. But this is to pay the price, the memory to maintain power, which will consume energy, fish and bear can not have both!

Auto Sleep, view the 3rd part of the picture above, you can set the system "how long after the inactive state, automatically enter the sleep state." For example, I am writing this article, and then the wife shouted to kneel the clothes board, kneeling for two hours. Within two hours, the computer is no longer in use and will consume a lot of energy if it does not enter the sleep state. In order to avoid this unnecessary consumption, you can let the system in accordance with the conditions (such as 20 minutes do not use), automatically sleep down.

The Auto put display to Sleep is similar in principle, except that the object of the operation is display (display, etc.).

Note:

I do not know if the reader has noticed that the snail in explaining the above words, has been in the red font emphasis on "computer is no longer used." This is the essential difference between generic PM and runtime pm, i.e. whether or not to suspend the use of the computer (even for a short period of time) on the user's subjective will.

This is also the reason generic PM is widely used in traditional computer operating systems, because the use of computers at that time is mostly a proactive approach. For the current mobile internet, it is very inappropriate, because people need mobile devices real-time online, real-time reception of passive events (such as incoming calls), it is impossible to subjectively suspend use (even a short period of time). This difference in final demand, will lead to a great difference in software design, because of this, the advent of Runtime pm and mature as soon as possible, it is particularly important.

3. Software Architecture for Generic pm

After introducing the basic concept of generic PM, let's take a look at its overall implementation in the Linux kernel and abstract the simple software architecture so that the main components of generic PM can be analyzed more carefully in subsequent articles. Specific as follows:

According to the above description, Generic pm mainly handles shutdown, restart, hibernation (hibernate), sleep (also known as suspend in kernel). In the kernel, it can be roughly divided into three levels of software:

API Layer, used to provide interface to user space, where shutdown and restart of the interface form is a system call (in the new kernel, the shutdown interface has a new way, specifically speaking of the time), Hibernate and Suspend interface form is SYSFS.

PM Core, located in the kernel/power/directory, deals primarily with hardware-independent core logic.

PM Driver, divided into two parts, one is architecture-independent Driver, which provides the Driver framework (framework). The other part is the specific architecture-related driver, which is what the power management driver development needs to involve (the red-framed module in the figure).

In addition, power management is a system-level module, which will involve the device model, process management and other aspects of the content, we can follow the specific analysis process, savor.

Linux power Management (2) _generic pm Basic concepts and software architecture (Volute technology, www.wowotech.net)

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.