The power-aware OS
The article describes the context and need for embedded operating systems that are more responsive to the power management demands placed on today’s electronic devices. It reviews the design objectives for the two main types of power management, reactive and proactive, and examines how both can be implemented.
For system developers designing portable electronic devices, the main dilemma has always concerned power management. How to maximize use and functionality while at the same time minimizing the battery’s cost and size to fit the shrinking form factors and longer lifespan demanded by users? Furthermore, consumers are demanding more functionality with every successive product generation. If a mobile phone does not have a Web browser, camera, audio/video capabilities, speaker phone, Bluetooth and a GPS receiver, it is a candidate for the scrap pile. With such a range of functionality being packed into today’s electronic devices, power management has become intrinsic to success.
At the foundational embedded operating system (OS) layer—the interface between hardware and end-user applications—device manufacturers are demanding more complete software platforms to meet the requirements of increasingly sophisticated applications. Within the core of the system, this OS layer is uniquely positioned to exploit power-saving features offered by the underlying hardware, while at the same time controlling user applications in a power-efficient manner.
Addressing power consumption
When employed by the OS, an application drains a device of its power. To take a mobile phone as an example, an application that uses the display heavily is a candidate for excessive power consumption. A typical scenario would be where the LCD keeps the back light active so the user can read the menu screen. Once a selection has been made—e.g., launch a video playback application—the LCD is on full power while the video is streamed to the phone. Is it high, medium, or low bandwidth video? Does the device support hardware acceleration? These variables impact how the system schedules power use. The CPU transfers the video and then decompresses it in either hardware or software. The end result is a user interface that displays the video, and a system that fully performs the task requested by the user—but in the process, too much power might have been consumed.
That was a simplified example, but it illustrates a key point. The OS ultimately controls all of the applications and as a result, must decide what is shut down and when. Power management raises a number of questions the OS must address. Which applications can be controlled? What power is necessary in the lower states and how much power needs to be saved when going into these states? The answers to these questions vary from device to device. The one variable not in question, however, is the fact that any good power-aware OS must be able to deal with a host of possibilities.
It is important to mention that many devices allow users the option to turn off or turn down the functionality of individual applications to extend battery life. While this may result in power savings, it is definitely not the type of power management the industry or consumers are demanding from next-generation portable devices. To truly tackle the problem, we must go deep into the OS and make fundamental changes to how a system is designed.
A greener OS?
For power management on a portable electronic device, we need to look not just at the hardware and software, but the entire system design. The hardware may well have features that reduce power consumption, but the software will often not take advantage of them. Therefore, in order for a battery-operated system to prolong its active life while in use, we must introduce energy-saving techniques at the OS level.
By definition, some embedded OSs are more power-efficient than others. All things being equal, an embedded OS that can be configured with the smallest amount of memory for a specific task is more power-efficient than one with a larger footprint. Where there is less code to execute and less memory required, you will conserve overall system energy. But beyond this basic consideration, a green OS had not been considered a design requirement for most engineers until recent developments in the industry and the increased concern about the global climate. Back in the day, the hardware was physically wired so that when a device powered up, a peripheral (e.g., an Ethernet controller) would also start up during system initialization. Regardless of its intended use, this ‘set and forget’ mode left the peripheral powered on as long as the system was on.
Further, it is easy to see why battery-operated device manufacturers have a vested interest in batteries that last longer, but what about manufacturers of electrical-powered devices such as DVD players and set-top boxes? These too can benefit from improved power management. If they use their power more effectively there is less of a drain on the power grid.
With a green, power-aware OS in mind, let’s take a look at a couple of energy-saving techniques that can improve power management. At the system level, there are two ways to solve power drain and extend battery life: reactive and proactive power management.
Reactive power management
We briefly touched upon reactive power management in the earlier discussion of the LCD example. This technique represents the most basic approach to power management. Essentially, it responds to each application in use at a given time, based on a set of preprogrammed conditions. For example, when there are no applications with open sockets, having an Ethernet controller powered on is wasteful because there is nothing using it. If the application opens a socket only when it needs to communicate, that is reactive power management.
A more sophisticated example might involve the process by which a USB drive is accessed by the software. If the file system is mounted and a file is open, and the application is reading and writing the file, then the device is active. But what if the task becomes busy in such a way that it does not read or write data into the file for several seconds? The system can reactively determine that the device is not using the USB drive, and after an inactivity timeout, tell the system to act accordingly.
This technique is depicted in Figure 1. Although basic in its implementation, it remains a good first step toward effective power management. It does have one major drawback though—by the time reactive power management takes place, electrons have already been sent through the system. Reactive power management does nothing to scale the processor. The CPU does not get scheduled correctly and prioritizations of tasks are excluded.
So while reactive power management helps start to preserve battery life, it is by no means the final answer. An even more efficient power management system is one in which an application gets scheduled for power consumption and is prioritized by the device, before the application is launched. Proactive power management is one way of achieving this goal.
Proactive power management
Proactive power management plays with the notion that developers can predict the future. Of course, that is not entirely possible; however, developers can use complex scheduling techniques to predict what the power use will be when the system is in operation. The data can be discovered manually by programming the system with a power-use scenario, or by dynamically measuring which domains are active and when.
For example, let’s say a mobile device has been asked to run the Bluetooth radio. The user is typing a text message on the keypad at the same time. What are the power requirements of the Bluetooth radio when the keypad is engaged? A proactive power management system might say, “Do not communicate at the highest speed, communicate at a lower speed.” The result is less bandwidth for the Bluetooth radio, but the system knows the keypad is in use, so high-speed bandwidth in not required. It’s all about trade-offs that do not affect the apparent device performance. With proactive power management, the user never notices any kind of performance degradation.
Proactive power management also works for file transfers. Developers can optimize the system so that a transfer still happens, but consumes less power by scaling back the voltage or frequency of the CPU. Proactive power management senses that instead of transferring a digital photo in five seconds, it can transmit it in 30 seconds with no discernable difference to the end-user experience.
Here is one final example. If a system has 10 tasks and all are ready to run, one would expect the system to be busy running these tasks. It makes sense to run the CPU at high power. It is important to note that which ten tasks are running might make a significant difference. If the system integrator can establish that every time a certain task is made ready to run—regardless of it actually being scheduled—the system will increase its power usage; then dynamic voltage and frequency scaling (DVFS) can be used. As seen in Figure 2,DVFS provides enough cycles to get the job done without wasting electrons. Continuing with this line of thinking, it is sometimes better to consume a little more power now so as not to degrade the quality of the user experience while waiting for the power modes to change.
Proactive power management techniques are the new wave in power management. Mentor Graphics, through its highly regarded Nucleus OS, is currently investigating several approaches in this area. These techniques will provide system developers and integrators the necessary elements to implement a more sophisticated power management policy.
Conclusion
The idea of a power-efficient portable electronic device must be taken seriously. System developers can begin to do this by taking a more holistic approach to power conservation, utilizing hardware and infrastructure designed to scale back power use and by using software that is capable of controlling a device’s overall power consumption.
At the very center of this approach is the concept of a power-aware OS that combines both reactive and proactive power management techniques. Whether it is the individual system developer or an electronic device manufacturer who is most actively pursuing a more power-efficient product line, it is the end-user who benefits most by having a device with improved battery life along with built-in capabilities that actually contribute to a greener planet.
Mentor Graphics
Corporate Office
8005 SW Boeckman Rd
Wilsonville
OR 97070
USA
T: +1 800 547 3000
W: www.mentor.com