Notes on comments.
Welcome to our blog dedicated to the engineering of Microsoft Windows 7
Happy New Year! The following post continues our discussion of fundamentals with a focus on power management. Power Management (or energy efficiency) is something that every contributor to the PC Ecosystem must always address—the energy efficiency of a running PC is limited by the weakest component. In engineering Windows 7 we had an explicit focus on the energy usage patterns of the running system and will continue to work with hardware and software makers to realize the collective benefit of all of this work. While we talk about the balancing of needs in every area, energy consumption is probably the most easily visualized—when we test running systems we connect them to power meters and watch a very clear number change as we run tests. (If you’ve seen the film Apollo 13 then you’ve seen a similar (albeit much more mission critical) struggle with a power budget.) This post is by Dean DeWhitt in program management team on our Kernel team. --Steven PS: Quite a few of us are at CES this week!
Energy efficiency is one of the most active topics in modern computing today. As evidence, consider that processor and chipset vendors are marketing products on “performance per watt”, instead of just processor clock frequency and benchmark performance. Perhaps you have seen a press release for one of the many industry consortiums focused on “Green Computing”--reducing the power consumption and environmental impact of computing. Finally, battery life continues to be a major purchasing and usability factor for mobile PCs. These related energy efficiency efforts in the PC industry result in an ever-increasing interest in how Windows manages power.
In engineering Windows 7, our goal is to deliver the capabilities and features users want from a Windows PC while reducing power consumption over previous releases. Windows already provides a rich set of energy saving features, including the ability to turn off the display and automatically put the system to sleep when the user is not interacting with the computer. For Windows 7, we are building upon the investments in these areas by extending the existing capabilities and focusing on reducing power consumption when the system is idle. Although Windows is responsible for managing the power state of many devices, including the processor, hard drive and display, the remaining devices and software running on the computer have just as much (if not more) impact on power consumption and battery life. This is a challenge for everyone contributing to the PC experience.
When we talk about energy efficiency and power consumption, we like to break down the problem area into 3 main components:
Realizing great energy efficiency from a Windows PC requires efforts in each of these areas. A problem with any single component in any area can have a significant impact on power consumption. Thus approaching energy efficiency from a platform approach and paying special attention to each component on the platform is required.
The base hardware platform is really dictated by the system manufacturer. The customer gets the ultimate choice when they buy a system—the customer can buy a system with ultra-efficient hardware components or can buy a system with components that favor performance over power consumption. There are desktop and mobile PCs in all kinds of form factors, with varying capabilities and power consumption levels. Some mobile PCs have a normal 3 or 6-cell battery, while others have an extended 9-cell battery or another external battery that can be added to the computer. The challenge for Windows is to be energy efficient across the wide range of hardware in the Windows ecosystem. Looking at a modern laptop, here is where the power goes:
Desktops will have a similar power distribution although higher in watts. The display is a large amount of the energy consumed in using your desktop PC as well.
The Windows operating system can have just as big an influence as any other component in the platform. In engineering Windows 7 our goal is to make sure Windows provides a great foundation and energy saving opportunities within the operating system starting with configuration of power policy settings.
The first place most users encounter Windows power management is through Power Options in control panel, or the battery meter on a mobile PC. For as long as Windows has had power management, Windows has had power schemes or power plans. The power plans allow you to easily change from one set of power settings to another, depending on your preferences.
Within a power plan, you can change a variety of Windows power-saving features, including inactivity timers for turning off the display, automatically putting the system to sleep or even creating a new custom power plan for the exact settings you want. The display and sleep idle features are very important for power savings and battery life. As above, the display can consume approximately 40% of the power budget on the typical mobile PC and anywhere from 30-100+ Watts on a desktop PC.
PC OEMs, especially makers of laptops, will often develop a custom set of power schemes that work to take advantage of differentiated hardware and unique software available on a specific model. So often you will see power schemes that carry the name of your PC OEM in the title. These have been developed by the OEM who is just as committed to energy efficiency.
Quick tips: The easiest way to save power on a desktop PC is reduce the display idle timeout to something very aggressive, such as 2 or 5 minutes. If you have a screen saver enabled, disable it to allow the display to turn off. On a mobile PC, the easiest way to extend battery life is to reduce the brightness of the display in addition. Also note that many of the new all-in-one machines use laptop components and thus from a power management perspective look like laptops.
Windows manages the processor performance and changes it dynamically based on the current usage to provide performance boost when required and conserve power based on the current workload. For example, when the system is mostly idle, such as when I’m typing this blog post, there is no need to be running the processor in the maximum performance mode, instead the processor voltage and frequency can be reduced to a lower value to save power. Similarly, the hard disk drive and a variety of other devices can be placed in low-power modes or turned off completely to save power when not in use.
For Windows 7, we’re refining the user experiences for power management, focusing on reducing idle power consumption and supporting new device power modes.
There are two reasons to optimize idle power consumption on the system. First there are various times throughout the day when the PC is idle and the more the system gets to idle and stays idle, the less power it uses. Second, idle power consumption is the ‘base’ power consumption for all other workloads. A system which consumes 15W at Idle will consume additional power over the idle power consumption while is use for other workloads. By reducing the idle power consumption on the platform we will improve most other scenarios as well.
The first step in reducing idle power is optimizing the amount of processor, memory and disk utilization. Reducing processor utilization is the most important, because the processor has a wide range of power consumption. When truly idle, the processor power consumption can be as low as 100-300mW. But, when fully busy, the processor can consume up to 35W. This large range means that even small amounts of processor activity can have a significant impact on overall power consumption and battery life. There are several areas of investment in Windows 7 that help reduce processor utilization and thereby enabling longer periods of time where the processor can enter into low power modes. One of these investments is in the area of services that are running on the platform and having those services only start when they are required referred to as “Trigger-Start”. While these services are efficient and have minimal impact by themselves, the additive effect of several services can add up. We are looking at smart ways to manage these services both within Windows but making our investments in this area extensible for others who are writing services to take advantage of this infrastructure. (Also note these are the same features that contribute to improvements in boot time as well).
To further help reduce idle power, we are focusing on core processor power management improvements. Windows scales processor performance based on the current amount of utilization, and making sure Windows only increases processor performance when absolutely required can have a big impact on power consumption.
We have made several investments in the area of device power management including enhancements to USB device classes to enable selective suspend across a broad range of devices including audio, biometrics, scanners, and smart cards. These investments available in Windows 7 enable more energy efficient PC designs. We have also invested in improvements to power management for networking devices, both wired and wireless.
While many of our investments in the core infrastructure improves energy efficiency across several scenarios, in Windows 7 we also focused on several key customer scenarios to identify resource utilization improvements to extend battery life on mobile platforms. One of these scenarios that we identified was media playback. The optimizations for DVD playback include reducing processor and graphics utilization, audio improvements, and optical disk drive enhancements. These improvements are already paying off and showing significant increase in battery life across a broad range of mobile platforms which we demonstrated at the WinHEC conference.
Graphics devices, USB devices, device drivers, background services and installed applications are all extensions to Windows. Large improvements in power consumption and energy efficiency can be realized by improving the efficiency of platform extensions.
For example, consider a single USB device that does not support Selective Suspend. That USB device itself may have very low power consumption (e.g., a fingerprint reader), but until that device enters the suspend state, the processor and chipset must poll the device at a very high frequency to see if there is new data. That polling prevents the processor from entering low power idle states, and on a typical business-class notebook reduces battery life by 20-25%.
Devices are not the only area that require efforts for great energy efficiency. Application and service software can also have a big impact on power consumption. Take for example an application that increases the platform timer resolution using the timeBeginPeriod API. The platform timer tick resolution will be increased and the processor will not be able to efficiently use low power idle modes. We have observed a single application that keeps the timer resolution increased to 1ms can have up to a 10% impact on battery life on a typical notebook PC.
We’re committed to helping improve the energy efficiency of Windows platform extensions by working closely with our partners. The strategy we’re employing is to provide rich tools to identify energy efficiency problems in hardware and software. For Windows 7, we’ve added a new inbox utility that provides an HTML report of energy efficiency issues—a “Top 10” checklist of power problems. If you want to try it out on Windows 7, run powercfg /energy at an elevated command prompt. Be sure to close any open applications and documents before running powercfg—this utility is designed to find energy efficiency problems when the system is idle. powercfg with the /energy parameter can detect USB devices that are not suspending and applications that have increased the platform timer resolution.
For more advanced analysis, we have provided the Windows Performance Toolkit. The Performance Toolkit http://www.microsoft.com/whdc/system/sysperf/perftools.mspx makes it very easy for software developers to observe the resource utilization of their applications, resolve performance bottlenecks and identify issues impacting energy efficiency.
So far, we have been talking about how to save power while the PC is ON. But, there are power savings to gain by entering low power modes when the PC is not in use. Many users simply Shut Down their computer when it is not in use, yet others use Sleep and sometimes Hibernate on mobile PCs. Windows features each of these power-saving modes so you can choose the right mode for how you use the system:
Using an example desktop PC, we measured power consumption for Sleep, Hibernate, Shut Down and the basic ON state, with just the desktop shown and no open programs. We also measured resume latency—the amount of time to get the system back to the ON state.
The chart makes it pretty clear why we focus on Sleep reliability and performance, and encourage most people to use it when they are not using their computer. Sleep consumes nearly the same amount of power as Shut Down, but resumes the system in less than 2 seconds, instead of going through the boot process. You can see that boot takes a significant amount of power so when considering whether to turn off your machine to save power or to put it into a low power state, think about how long your machine will be out of use. Nevertheless, as we’ve talked about in previous blogs boot (and shutdown) are obviously very important performance scenarios as we engineer Windows 7.
We are committed to continuously improving the energy efficiency of Windows PCs, and have made significant improvements to core platform power management for Windows 7, as well as tools to identify where power is consumed. We still have more work to do, and look forward to our upcoming Beta release and monitoring incoming CEIP telemetry for energy efficiency and power management results. Of course we continue to work very closely with the other members of the ecosystem as we all have much to contribute to energy efficiency—from the manufacturing, usage, and end of life of a PC, software, and peripherals.
Windows needs more proactive CPU throttling as far as applications are concerned. There are many issues there.
A lot of poorly written apps (and this includes some very commonly used ones, such as certain browser plugins, instant messenger programs, media players...) use near-spin-locks on one or several threads, that is, a loop with a sleep(1) which wakes a thousand times per second.
Problem #1: CPU usage is unaccounted. Even if they're burning ~25 million cycles per second each, it shows up as 0% CPU usage in the task manager due to insufficient sampling granularity and and other problems.
Problem #2: CPU cache trashing is unaccounted. Cache trashing slows down the rest of applications as they have to re-read stuff from RAM. This isn't too troubling but it's worth keeping an eye into.
Problem #3: timeBeginPeriod() interactions. This is the worst one. By default, the timer interrupt comes every 10-16ms, limiting the damage of sleep(1) loops (they'll only wake at most 60-100 times per second). However, it only takes one application calling timeBeginPeriod(1) to raise the timer to 1000Hz, and now a lot of threads are waking up 1000 times per second. A lot of applications do this (media players, browser plugins...) so in a lot of cases the system's running at 1000Hz.
I suspect the 10% impact figure comes not from the increased tic rate, but from all these stupid spinlocking sleep(1) threads who suddenly run 10 times as often.
Could there be option to force low-power mode for CPU,regardless of utilization? (For old(er) games(ST Armada,Dark Reign,...) and majority of movies (videos from Youtube,Reuters,...,movies in DVD quality) it is not necessary to increase power of CPU,since it is still enough.
"If you you sell 12 differents laptop configurations (or 20 I don't know) you can optimize the whole OS/drivers to run very efficiently"
Apple uses the same OS for a large number of hardware configurations. It's the same OS used in their workstations, desktop PC's and laptops, in current, previous and upcoming models. OS X has pretty broad hardware support too. True, it may be less than Windows runs on, but a hell of a lot more than 12-20 configurations, and too many for them to realistically optimize the OS for each combination. It also assumes that Apple is able to control the drivers too, which seems doubtful.
But this is still missing the point. The point is simply that "such a big gap is unacceptable to many customers". A lot of people would think twice before buying a Windows laptop if someone told them that a Mac with the same hardware would last twice as long on the battery. Whatever the cause, and even if it is as simple as you claim, it's something Microsoft is going to have to deal with. Either by debunking the figures or by solving the problems that cripple battery life so much.
But saying "Yes, but that's because Apple is able to optimize their systems, and we aren't" is not going to fly. That might explain *why* the difference exist, but it's hardly going to make Windows-based laptops more competetive. The only way to do that is to make this difference in battery life go away, one way or another (of course, one valid way to do that is to demonstrate that it was just a fluke all along, and Anandtech were mistaken). But saying "nothing can be done about it" like you do isn't an answer.
Ooh > Thx for clarifying this and thx to steven (The only VP I've seen commenting on blogs so far ;)) for the confirmation.
That kind of informration should be more broadly diffuse to the IT pros/Devs (maybe an article in technet/msdn magazine?), because that's the kind of choice we should be able to help our "clients" with.
Klimax> I think that's what the "power saver" from the "power plan" section is for. I digged a little further and found that in the advance settings of that plan under "maximum processor state" is set to "100%" which shouldn't be the case as you pointed out.
For now the only way I have found to ALWAYS have minimal power user on the CPU level is to set it into your BIOS but that is up to the manufacturer itself to let you control it or not and we can all agree that rebooting your machine entirely each time isn't useful at all (especially when you hibernate/sleep).
Maybe there's something you could do about it.
A bit off-topic, but MSDN and Technet subscribers may be interested to know that the beta is now available from Subscriber Downloads :)
Thank-you all for the hard work ands the Connect Invitation, I am impressed with the Beta, I am now running Build 7000 Beta 1...Fast Install & the fastest boot time I can remember! The Logo SDK looks intresting, I will not be using the RTM version and now down to the brass tacks with Windows 7 Server and the networking environment...plus my Robotic Telescope likes Windows 7 , CCD Camera works and my data bases are running smoothly.
And to the Mac boys out there I can do this from a Laptop with 512mb of Ram and a 799mhz processor!
Sleep works very well for conservation of batteries, I post this from the feild.
Whoop Whoop Whoopie...back to looking for sucker holes in the night sky!!!!!
1 Key = 1 PC to activate Beta?
According to the EULA, it can be used on any number of computers so long as they are on the same premises.
Domenico > If you refer to past beta for vista, one key can be used to activate many computer. Microoft wants you to test the OS on as many computer as you can. I don't see why that would change with windows 7.
My friend have MSDN subscription and more PC.
for now the key of Windows 7 in MSDN Download is valid for 1 PC :(
I have 3 pc (with Vista Ultimate)
That's interesting. I haven't tried multiple computers yet but MSDN usually lets you request additional keys if you need them.
Screen displays may need to think about using more black or dark. Current LCD have backlight on uniformly but LCD with LED backlights in adaptive patterns will become feasible during Win7 lifetime (they already are common in TVs) and these can save power by not using LEDs in parts of the screen which are dark. Also OLED screens expend energy only where you need the light. So using tricks like darkening windows not in the foreground, or using black backgrounds, or screen savers with just a small design lit, these can save significant energy in technologies which are in the pipeline now.
Sorry but... Where I can download win7?
Holy hell didnt any of you computer geeks realize that all of the power percentage on the lap top only added up to 90%.