Thought Leadership

How is power consumption affected by the OS?

Over the past few years, there has been an increasing concern about power consumption of embedded devices. This is commonly because devices are battery powered and there is a focus on getting the most use out of a charge. However, environmental pressures mean that mains-powered equipment needs to have the minimum power dissipation possible. Historically, power consumption was considered to be firmly in the hardware designer’s domain, but that is no longer the case …

Hardware design is significant to power consumption; it sets the minimum power that the device will consume. It is the job of software to keep power consumption down to as near this minimum level as possible. I discussed this matter, in relation to developing optimal code, a few weeks ago. Power also needs to be in the developer’s mind when selecting software IP components, like an operating system.

In considering the influence of OS choice on power consumption, there are two broad factors:

  1. operational efficiency
  2. power management facilities

Operational efficiency

The efficiency, from the power perspective, of an OS is a function of two, sometimes opposing factors. The smaller the memory footprint, the less memory required; less memory means less power. The speed of the OS – i.e. how few machine cycles it takes to perform operations – is more significant. To the first approximation, it may be considered that each machine cycle uses a certain amount of energy, so less cycles means less power.

A colleague of mine did some research. He showed that the amount of power the CPU consumes, when doing a particular job, will vary depending on the OS. His experiment was conducted using a media player device. It was decoding an MP3 of a 71db 220Hz sine wave. He ran the code twice: the first time executing the application under Nucleus, the second using Linux. The power consumed was measured and plotted over time.

On the plot, power consumed, when running Nucleus, is shown in pink; Linux is dark blue. The results are interesting: when running Linux the CPU was consuming nearly 25% more power than when it was doing the exact same job under Nucleus. There is also an increase in power consumption of another 20% [between about 3000 and 4000 on the plot] when running Linux. What caused this? We do not know. Obviously Linux was doing something in this time frame, which affected its CPU load.

Power management facilities

Properly designed hardware provides software with control over a number of factors, notably CPU frequency/voltage, switching peripherals on/off, and using low-power CPU modes. The OS is the layer between the application code and the hardware, so it is logical to locate the control software there in the form of a power management framework. The software “knows” what resources [peripherals, CPU performance etc.] that it needs and can communicate this, via an API, to the OS, thus optimizing the power consumption or “energy footprint” of the device.

Colin Walls

I have over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, I am a member of the marketing team of the Mentor Graphics Embedded Systems Division, and am based in the UK. Away from work, I have a wide range of interests including photography and trying to point my two daughters in the right direction in life. Learn more about Colin, including his go-to karaoke song and the best parts of being British: http://go.mentor.com/3_acv

More from this author

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2020/08/03/how-is-power-consumption-affected-by-the-os/