Prolonging battery life with Windows 8
Microsoft wants to make sure users don't have to worry about saving resources with their Metro-style apps
By Tim Greene | Network World US | Published: 15:30, 09 February 2012
Windows 8 is stingy doling out power to applications, particularly what Microsoft calls Metro-style applications written specifically for the operating system, all in an effort to prolong battery life.
This is important because Windows 8 devices include more battery-powered devices such as tablet computers.
According to the latest Building Windows 8 blog power efficiency is a priority feature that is designed into the operating system but also supported in Metro-style applications via a set of APIs that allow background application activity without draining battery reserves.
Related Articles on Techworld
The developers say they tried to let applications in active use grab the resources they need but strip down the resources used by applications that are standing by.
Power scrimping extends to the operating system itself, the company says, an effort it calls power hygiene. The goal is to balance this economy with functionality, so, for example, applications finish tasks they have started even if users switch to something else.
This is the principle the engineers followed: if an app is not on screen, and the screen is not on, it should not impact battery life. The goal is to suspend applications that are not in active use, so any app should be in one of these three states: running in the foreground; suspended; or performing a background activity like printing.
Suspended apps get dumped from CPU scheduling; they don't even get the chance to tap the main processor. If enough apps are suspended and not making demands, the CPU could drop to a lower power state, the blog says.
The OS has a Background Tasks infrastructure that enables Metro apps to manage resources and give users options to set rules on background-task activity.
The system knows when it is plugged in and will run more background tasks then when they won't affect battery life. The example they give is of a news-reader app that pulls down content at night when the user is asleep, and the device is plugged in but otherwise idle, providing fresh news when the app is fired up in the morning.
The upside for users is they won't have to limit the number of apps running at any given time and can expect them to respond immediately when they are switched to. They don't have to worry about resources and shut apps down manually.
"The benefit of being able to suspend apps is that you get really fast switching between them without negatively impacting the battery life or performance of your system. This is altogether different than traditional desktop apps, where we are all used to optimising our workflow for those apps that take a long time to launch."
Suspended apps do consume memory, however, and Windows 8 can shut down apps if system memory starts to run low. When that happens, apps that haven't been used recently are shut down. The system saves the state of the shut-down app so when it is switched to, it opens to the same point it was at before it shut down. The user experience should be very similar to what it would be if the app had not been shut down, the blog says.
This requires developers of Metro apps to write to the background API to take advantage of the power savings. Traditional desktop apps run on Windows 8 but sap battery life the same way they do now. They are playing music, downloading/uploading files to Web sites, refreshing live tiles with content, printing, receiving VoIP calls, instant messages and emails, sharing content and synching with tethered devices.
"But over time, we're equipping Windows to get more done and use less power, with new applications that help you get that work done - from entertainment to professional tools and everything in between," the blog says.
New PCs architected around system on a chip don't turn off when they're inactive but remain running in a very low power state called connected standby. Traditional apps still stop running during this lowest power state, but Metro apps stay alive.
For Metro apps, Windows 8 also includes a feature called Desktop Activity Moderator that is the mechanism for putting the apps into standby so they don't drain battery life.
Connected standby mode doesn't shut down drivers, some inbox and third-party services, and Metro apps that use background features.