Building a power-smart general-purpose Windows


In this post, we look at the broad topic of developing an OS to reduce power consumption. We've seen an ever-increasing emphasis on power management in the OS from two perspectives. First, as Windows 8 comes to market, it is easy to see two-thirds of all PCs shipping as portable devices operating on batteries some or most of the time. And second, in the workplace, there is an increasing demand for desktop machines with a reduced carbon footprint as we look to save energy wherever we can. In all cases, this goes beyond standby/hibernate/resume performance and gets to the heart of this post which is about reducing the overall power consumption of the OS and providing OS support for power-saving capabilities in modern hardware. Pat Stemen, a program manager on our Kernel team, authored this post.
--Steven
Battery life and power consumption continue to be some of the most important topics in the computing industry. We wanted to give you a look at how we think about power management for Windows 8, and how we measure power consumption on a daily basis. We consider power management a core OS capability that is critical on any chip architecture and any PC form factor.

Our goals

We have 3 goals in mind when engineering Windows 8 power management:
  • Let the hardware shine. We built Windows 8 such that the power efficiency of the hardware platform shines through, regardless of whether the system is a SoC-based Windows tablet or an SLI-equipped gaming PC. We designed our power management interfaces in a consistent, standardized way across all platforms. This allows our hardware partners and application developers to focus on their unique innovations and experiences instead of the differences in platform hardware and power management.
  • Continue to deliver great battery life. Windows 7 delivered a significant reduction in power consumption and increase in energy efficiency, particularly mobile PC battery life. (In fact, you can read how we thought about it in this e7 blog post.) In Windows 8, we want to maintain that same level of efficiency on existing PCs even as we re-imagine the rest of Windows.
  • Enable the smartphone power model. One of the coolest things about the System-on-Chip (SoC) platforms you’ve seen us talk about at CES and //BUILD/ is their capability to quickly enter very low-power idle states. We want to leverage that ultra-low idle power to bring the constant connectivity and instant-on features of the smartphone power model to capable Windows 8 PCs.

Why it matters

Most of us are probably familiar with one impact of good power management—long battery life on our mobile devices. Mobile computing devices are highly scrutinized for their battery runtime with good reason—we are using them on battery more often than ever before. Delivering consistently long battery life requires a lot of well-executed coordination between the underlying hardware, operating system, and application software. (Battery capacity and its quality over time also have a big influence on runtime.)
In addition to mobile battery life, the next most tangible impacts of good PC power management are reduced energy costs and environmental impact. The benefits of power-managing enterprise desktop PCs and servers in the datacenter are typically positioned as reducing the amount of money required to power and cool those systems as well as the resulting reduction in greenhouse gasses required to produce the energy for them. It’s hard to underestimate the impact here—very small changes done well in Windows can result in very large positive environmental impact because of our scale. In many markets around the world, increasing electricity consumption is putting more demand on every aspect of the workplace to reduce power consumption. PCs are a significant source of potential savings.
Power management is also in a fine balancing act with system performance and responsiveness. As an example, we can easily reduce processor performance to save power, but as we do so, we increase the time required to process a given workload. Doing a great job of balancing power and performance is a key requirement across the Windows user experience.
We are also observing a lot of tech blogs reviewing the latest processors and hardware platforms, not just on GHz and benchmark performance, but also on the power consumed to execute the workload. These measurements combine power and performance into energy efficiency—how much power does it cost to execute some fixed workload. “Performance per watt” is the same thing.
However, the thing that excites us the most is how power management is fundamental to all aspects of PC platform design. Power management directly impacts attributes including thickness, weight, acoustics (fans and their speed), skin temperature, cost, screen size, resolution, RAM quantity, etc. Hardware that is thin, light, always connected, and runs all day on battery is cool. We love being a part of enabling that for the Windows ecosystem.

Power as a resource

We think of power as a critical system resource, just like CPU utilization, hard disk activity, or memory consumption. Because it is a core resource, we track how much of it Windows consumes daily in each daily build of Windows 8. This allows us to quickly spot changes in power consumption and work closely with the development team to find the root-cause of the issue, develop, and then test any changes required. As power consumption is reduced, we get a new baseline to measure against future daily builds.
Raw power consumption (e.g. how many milliwatts) on any given Windows PC is the result of a number of platform factors including the CPU and chipset, the type and amount of RAM, the speed, type, and capacity of the storage drive, screen size, etc.
In order to have a consistent baseline, we identify a set of reference platforms and measure their power throughout the Windows 8 development process. Our reference platforms are representative of the type of machines commonly used by our customers. They include platforms from each of our major silicon chip partners. We use power consumption in Windows 7 and Windows 7 SP1 as our baseline, and compare that to measurements taken from Windows 8 builds throughout the development process.
Graph shows idle power for various builds (from 8074 to 8144) of Windows 8 at between 9000 and 10,000 mW, but in build 8114, this spiked to well over 10,500 mW.
Total system idle power measured in our lab for one reference platform. 
You can see a change that caused a ~1.25W increase, which was fixed in a subsequent build. Note that some variance between runs and builds is expected.
We measure the power consumption of many software workloads on each of our reference systems. The workloads we measure are similar to 3rd party battery benchmarks in that they are designed to be representative of core scenarios that we all do with our machines every day. Our core workloads include Idle, Web Browsing, Video Playback, Audio Playback, and Standby.
You might be thinking that spending time on the idle workload isn’t useful—after all, few people boot their machines and just let them sit at the Start page and do nothing else. While that is true, we think of the idle workload as the floor of power consumption for the system— it’s the minimum amount of activity that the system has when active. Reducing power consumption at idle reduces the base power consumption of most other workloads, including video and audio playback. Plus, a lot of workloads have significant idle time in them—from small amounts of time between keystrokes when typing, to the minutes between slide transitions when giving a presentation.
The common way to measure power for a mobile Windows PC is a battery life rundown test, in which the battery is charged to 100% and then the battery is drained to 0% while repeating the workload. This method works, but is prone to error as the battery capacity naturally degrades over multiple charge/discharge cycles. Each rundown test is an extra charge/discharge cycle, and we test every day. Thus our measurements could drift over time due to battery degradation.
We have a power measurement setup in our performance lab that allows us to provide reference platforms with direct DC power and measure the consumption. We mentioned the lab and overall capability in our IE blog post on browser power consumption, but didn’t mention that we have a number of real reference laptops set up to measure power consumption every day. The power supplies and their metering capability are automated with test software so that we can continuously install Windows, measure power across scenarios, and then analyze the results with each new build of Windows 8.
A shelf full of machinery that monitors DC power usage
DC power supplies with built-in measurement capability
A laptop running Windows 8, plugged into a box that measures power consumption
Reference platform instrumented for DC power supply and measurement

How software influences power consumption

Software can influence power consumption by consuming resources—CPU, disk, memory, etc.–as each of those resources has a power cost associated. Software also influences power consumption through the OS and driver software responsible for managing hardware power states.
Windows 8 features 3 key innovations to improve how software influences power consumption—the Metro style app model, idle hygiene, and a new runtime device power management framework. We will give you a brief overview of how these innovations improve power consumption in this blog post.

The Metro style application model

Most of us have experienced the influence of software on power consumption first-hand. It might be that you have an app on your phone that goes through battery quickly or you’ve heard the fan turn on in your laptop when playing a game or computing a spreadsheet. These are all examples of applications directly consuming CPU, GPU, network time, disk and/or memory.
One of the new power management innovations in Windows 8 isn’t a power management infrastructure feature; it is the Metro style application model itself. The Metro style application model is designed from the beginning to be power-friendly. The power management benefit is that the model makes it easy for developers to ensure their application is running only at the right time—applications in the background are suspended such that they do not consume resources and power when not in use.
Of course, we recognize that background activity is a critical component of apps that are always connected and responsive. The Metro style application model and the underlying WinRT support background activity through a new set of capabilities called background tasks. (See this Introduction to Background Tasks for more details.) Background tasks make it easy to perform background activity in a power-friendly fashion. They also enable developers to continue to deliver responsiveness and “freshness” in their applications, but the mechanisms are different than the existing Win32 model because of the desire for a fast-and-fluid interface and the other key attributes of Metro style apps (see 8 traits of great Metro style apps).
We’ve engineered background tasks and the overall Metro style application model to enable a new level of app responsiveness, while at the same time considering overall system attributes including power and memory consumption.
 Processes tab (more details view) shows several Metro style apps in suspended mode, all at 0% CPU, and using between 17 and 85.1 MB of memory.
Task Manager showing suspended Metro style apps

Idle hygiene

Software can have dramatic influence on power consumption even without consuming a lot of resources through intermittent idle activity. We refer to improvements to idle activity as idle hygiene.
Most PC platforms feature processor and chipset idle states that allow the hardware platform to stop the clock or completely turn off power to parts of the silicon when they are unused. These idle states are absolutely critical to enabling long battery life, but they require a minimal residency duration—that is, you have to be idle for long enough to make the transition in and out of the idle state worthwhile in terms of power used. This is because some power is consumed on the way into and out of the idle state. Software most effectively uses these idle states when there are as few exits from the idle state as possible, and the duration of the idle state is as long as possible.
We track the idle efficiency of Windows 8 using built-in ETW Tracing, some additions to the Windows Performance Analyzer, and a basic histogram. Below, you can see the difference in idle durations between Windows 7 and Windows 8. When the screen is on, we’ve already moved the bar significantly from a maximum idle duration of 15.6ms in Windows 7 to 35% of our durations longer than 100ms in Windows 8! With the screen off and during Connected Standby, our idle durations are even longer, currently in the tens of seconds.
Chart comparing Win7 and Win8 idle period duration with screen on. In Win7, about 95% are 10ms - 16 ms. In Windows 8, this is approx. 35%.

Runtime device power management

PCs attain their longest battery life when all devices, including the processor, storage, and peripheral devices enter low-power modes. Almost every device in the modern PC has some kind of power management technology, and runtime device power management determines how we use those technologies seamlessly without impact to the user experience. A really good example of runtime device power management is dimming the automatic display after a timeout in Windows 7.
Just to underscore how important device power management is, we have seen many systems where not enabling a single device’s power management features can easily reduce total battery life by up to 25%! (It’s worth noting here that disabling a device in Device Manager is almost equally bad—most devices are initialized by firmware at their highest power modes and require a device driver to get them to a more nominal power consumption.) You can diagnose some device power management problems using the built-in powercfg.exe utility in Windows 7 with the /ENERGY parameter. The output of /ENERGY is an HTML file that gives you a view of which devices and software are potentially running in a power-consuming state. Of course, using the factory image for your PC that came loaded with OEM and vendor-supplied drivers is almost always the best way to ensure the devices in your PC are well-behaved for power management.
Efficient power management of devices is performed by the driver for the device, in conjunction with the Windows kernel power manager and platform firmware. The power manager makes it easy for the drivers of these devices to implement their power management routines and coordinate any power state transitions with other devices on the platform.
For Windows 8, we’ve built a new device power framework that allows all devices to advertise their power management capabilities and integrate them with a special driver called the Power Engine Plug-in or PEP, designed for SoC systems. The PEP is provided by the silicon manufacturer and knows all of the SoC-specific power management requirements. This allows device drivers like our USB host controller or a keyboard driver to be built once, and still deliver optimal power management on all platforms from SoC-based PCs to datacenter servers.
We are hard at work with all of our ecosystem partners to deliver the low-power and long battery life technologies we all want in our Windows 8 PCs.

0 comments

Posts a comment

 
© geekOgizmo | Gizmos for Geeks, Technology for Technofreaks, Information for Infofreaks
Designed by Jotish Suthar Dinesh Kothari
Back to top