Write more energy-saving programs

Source: Internet
Author: User

Http://software.intel.com/zh-cn/blogs/2011/12/26/400009546? Cid = Sw: prccsdn2127

When you see this question, the reader may be surprised: The Code also has the power saving and no energy saving points? We say, yes. In essence, the program schedules hardware resources. unreasonable hardware scheduling will make the device scheduling less efficient, resulting in higher energy consumption. In fact, with the popularity of mobile terminals, power consumption ratio has become an important parameter for comparison processors. In the already-listed, ultra-high computing power (Ultrabook), power consumption has become an important consideration. In fact, Intel has already considered the Power Consumption Optimization at the hardware level. Microsoft will enhance the Power Consumption Optimization in Windows 8, and third-party software will inevitably affect the power consumption, in fact, killing behaving software or services may even result in a loss of power optimization on all hardware and system layers.

 

Currently, for homogeneous software, the difference lies in performance, functions, user experience, etc. In the near future, power consumption may become one of the important features. Imagine that, after the popularization of super books, a software can support 10 hours, and the other can only be 7 hours, users, especially those without external power supply, will naturally prefer the former.

 

What kind of software is energy-saving? Generally, we can look at the following two states:

 

Idle workloads:

 

1. the processor and platform can be in the idle state for a long time to avoid high-frequency software execution, such as statistics;

 

2. tasks should be combined, coordinated, and processed in batches as much as possible; frequent execution of programs should be avoided and background services should be minimized;

 

3. Software cannot affect the power state of hardware components on the platform into a deep layer (often due to too many interruptions ).

 

4. When the system idle is used, speed down the hard disk (spin down ). Avoid periodic hard disk access registration.

 

Active workload:

 

1. Improve the computing efficiency and CPU usage efficiency, so that the system enters the idle state for a longer period of time;

 

2. Reduce the number of C-state Switches of the processor. Frequent C-state switches will cause energy loss;

 

3. For a multi-core architecture, the concurrency of multi-core program execution can be maximized, so that resources at the package level and resources at the platform level can be managed more effectively;

 

4. Reduce the program execution frequency. For a task with a specific CPU usage, it can run for a longer time, a lower frequency, and more energy-saving.

 

5. in the program, if the timer resolution is improved, the power consumption is greatly affected. Try to use a large timer interval. If a small timer interval is required, after the task is completed, reset it to a large value.

 

 

 

In actual power consumption analysis, package state, core state, and C-State are all important parameters. From the above points, we can see that the so-called Power Consumption Optimization is essentially nothing more than performance optimization from the platform perspective. Power consumption is not only a matter of CPU performance, but the first step is to reduce CPU utilization. Intel's vtune tool can be used.

 

(:/En-US/articles/Intel-vtune-amplifier-Xe /)

 

For the Power Consumption Optimization of the platform, we also need to consider how to improve the concurrency of the program and how to reduce the power loss of peripherals (hard disks, etc.), which are related to the running characteristics of the software. We will further analyze how to write more energy-saving programs in our future blog.

Related Article

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.