Windows Vista Power Management

Jim Allchin on Vista blog --"One of the biggest improvements in the mobile PC experience for Windows since the early 1990 is longer battery life. The trick here is to make the system as efficient as possible while still maintaining a great user experience. At the same time, the increased cost of electricity has become […]

Jim Allchin on Vista blog --"One of the biggest improvements in the mobile PC experience for Windows since the early 1990 is longer battery life. The trick here is to make the system as efficient as possible while still maintaining a great user experience. At the same time, the increased cost of electricity has become a key factor for enterprise customers who are under continued pressure to manage TCO (total cost of ownership). As a result of all of these factors, we decided to make some extensive changes in the power management sub-system for Windows Vista."

The Windows Vista power management goals were simple: 1) making turning a computer "off"/"on" as reliable, simple, and fast as turning off/on a TV, and 2) maximizing the active usage if on battery and reducing the energy consumption if on A/C power. The first goal involved not only improving the predictability of the behavior when a PC was switched "off", but more importantly changing the model for what "off" and "on" means. Everyone knows that turning a TV off doesn’t really turn it off. It is still available to receive the remote control signal, etc. so that it can come back on quickly. We wanted to emulate this for Windows Vista machines.

To the degree possible, "off" equals "sleep" in Windows Vista, where the system state is saved in RAM. This creates the best balance of user experience for speed of resuming and lowest usage of power. However, if the PC is running on batteries even that minimal power usage could drain the batteries eventually. Remember the top goal here is to make sure that we can enable a fast on experience (like your cell phone) and a fast off experience, while still making sure that you don't lose your work when a Windows PC is turned off. To do this, we created a new approach that we call "hybrid sleep state" that is the best of the sleep and hibernate modes (which existed separately in Windows XP). In this hybrid mode, the state is stored both in RAM and on disk, so nothing can be lost if power goes out. Then the system is suspended into the low powered sleep state for a period of time (like your cell phone). Normally, when the user returns and wakes the machine, system state is just restored from RAM, and resume responsiveness to the user is fast. However, if for some reason power is lost (for example, if the PC is unplugged to move it -- like you might move your TV), the system can still resume from the hibernate image previously saved to disk with all context and data intact.

While Hybrid Sleep can be used on a laptop computer, it isn’t as applicable to laptops for a couple of reasons. First, a desktop is vulnerable to power loss, while a laptop can of course run on its internal battery. A laptop can also detect or even wake up from standby when the battery is low so Windows can save everything to the disk before the battery is completely drained -- and remember, in the sleep state all the battery needs to do is to refresh the RAM, which takes very little power. Also, mobile users want a grab-n-go usage model, so taking extra time after the laptop lid is closed spinning the disk to write out a potentially large hibernate file could be a problem. Lastly, after a laptop has been in sleep for a while, the system will wake up and immediately go into the hibernate state. This state uses absolutely no power, so even the minimal battery drain used in standby is removed. If the system is in this power state when the user wants to use the system, then the system state is restored from disk.

In either case (suspend to RAM or disk), though, the user conceptually just thinks of "on"/"off." In the case that the machine hasn't been used for a long time, then the only difference to the user is that it just takes slightly longer to resume back to where they were. As I mentioned, if the system is A/C-powered, then by default we leave the system in the sleep state (never going into hibernate) so that the machine can be virtually instantly available, but still have substantial power savings compared to past systems. The bottom line is that because there is no reboot, the PC can respond much more quickly.

In order to ensure that "off" worked effectively with this new model, we needed to address some unpredictability that occurred with sleep in Windows XP. Instead of waiting for each application, service and device to agree before going into power saving mode, in Windows Vista we changed the approach so that we give the application, services and devices a notice of the impending suspend and then wait a maximum of 2 seconds for them to finish up any work and put themselves into a state they can continue from when the system wakes up. With Windows Vista there won’t be any more sinking feelings when the airplane is at 10,000 feet and you reached into your laptop bag to find the laptop all cozy and warm because it didn’t go into power saving mode when you were running for the plane -- caused because some device, service, or application wasn't well behaved. One of the interesting things about the new power management system is that Windows Vista is able to come back from the sleep state so quickly that the first time you open the lid on a suspended Windows Vista laptop you might wonder if it was on the whole time -- trust, me it wasn’t.

Our second goal was to reduce the power consumption of PCs when they are idle. In the past the few users who did shut down their PCs when not in use had to sit through a long boot process to get their PC back on. However, many enterprises and home users just leave their PCs on 7x24. While this is nice to be able to have the PC ready to respond when you sit down at it, powering a PC overnight just so it can be available to you when you sit down at 8AM is a pretty expensive approach.

In order to achieve the second objective -- reducing power usage -- we made changes to dramatically improve idle power consumption. The dream was to reduce power consumption by powering key components down more frequently and leaving them powered down for longer periods while still maintaining a great user experience. For example, while Windows XP did a great job of lowering CPU speed and voltage whenever possible, in Windows Vista we added enhanced capabilities to use power more efficiently on multi-core systems. And we have created new APIs so that driver and application developers can get notifications about the power scheme being used on the system and then adapt their behavior for the power scheme. Finally, all of the power management configurations parameters can be controlled by the IT department (on a PC-by-PC basis) using Group Policy if they want to tweak the defaults, making corporate deployment of these features easily manageable.

How much power is used and how great the experience is depends on all the equipment and software attached to your system. So, we created some great tools including the Power Event Monitoring tool to help develop and test applications, as well as some great content for developers on power management. We have also made the power management system extensible, so that instead of writing separate power management solutions, third parties including computer manufacturers can closely integrate their unique features and capabilities with Windows.
Continue for more info....

Windows Vista Power Management