Software Development
How energy efficiency can be part of development with specific tooling, the choice of the programming language and the design of the Android™ architectureUnlike in the early days of computing, the vast majority of programs are no longer written in the only language computers understand. Machine code gives the highest amount of control over the actual execution of a procedure to the programmer. However, the increasing amount of code complexity and diversity of machine code by different manufacturers have required the addition of multiple layers of abstraction.
The balance between the amount of low-level access, i.e. the ability to directly target internal functionality provided by a computer, and abstraction has been handled very differently. The higher the level of interaction is, the more machine code is necessary in between to mediate, which increases the amount of energy consumed. However, a lot of those techniques such as compilation, i.e. the translation from program into machine code, have been developed for decades and can provide general optimisations for most use cases. Furthermore, they can free up resources to work on project-specific efficiency problems.
As the amount of mobile and embedded devices has drastically increased, the impact code implementation has on the environmental footprint has as well. On the lowest level, every line of code is responsible for a certain amount of energy consumed by the device. Giving developers the opportunity to estimate this cost during programming on a fine grain level can be a powerful tool for creating efficient and power saving algorithms. Furthermore, extensive benchmarks can improve the choice of technologies based on their performance in the types of procedures that they will be used for in a particular project.
Developers of mobile software have been leading the effort to create more energy efficient software, particularly because of the increased constraints on computational speed, provided memory, as well as power availability applications, they have to work with. Even though smartphones are manufactured using similar processors, the architectural structure presented to the programmers differs from normal PCs. As mobile devices are typically used with a more limited, often personal purpose, security and compatibility are of high importance. Therefore, the actual applications are separated from the hardware in extra layers of abstraction, and some features including access to the Internet or camera are restricted and thereby provide fewer possibilities for case-specific optimisations.
Mobile green computing is a very challenging and an area of vibrant research. Tools created and data collected which give developers detailed feedback about the efficiency of their code as well as the programming language of their choice can be used to help guide the process of coding. Furthermore, knowledge about the visible architecture and associated cost of its functionalities are essential to reduce the amount of energy used significantly.
Estimating Energy Consumption of Applications
The mobile market stands out with its greater homogeneity of operating systems than there is among personal computers. More than 80% of all smartphones run a version of Android, while the remaining 10-20% can almost entirely be attributed to iOS (4). Still, the absolute energy consumption of running the same program on different hardware varies, which restricts statements about performance only to be relative. Theoretical analysis of the actual code can be used to make more universal estimations, instead, and has the advantage of allowing programmers to approximate the energy efficiency at different levels of granularity without having to measure it in practice. Therefore, recent research has looked into different ways of modelling the power usage of mobile applications. They range from comparisons with calibration data to the analysis of abstract representations of code and the execution paths it takes.
The article about energy estimates presents some of the different approaches to obtain approximations of the energy consumption of programs and evaluates their possible impact on development.
Energy Efficiency of Programming Languages
Programming languages are the interface software engineers use to declare the functionality of their programs. Since the invention of computers, several new ways to implement programs efficiently and elegantly have been discovered. Some languages that are still used today like C or Pascal have been created in the 1970s or earlier when the first computers intended for personal usage were released, while others like Go or Rust were introduced around or after 2010. They use different models of execution ranging from static compilation to dynamic interpretation as well as various paradigms. Those differences have a substantial impact on the amount of energy used during the execution time of a program as well as the amount of memory that is needed.
An overview of the methods and results of comparing programming languages with those criteria is provided in the article about their efficiency and accompanied by a tool to analyse the complete dataset.
Execution Model of the Android™ Architecture
The Android operating system developed by Google was first released in 2008 and is based on the Linux kernel. It consists of a hierarchy of layers of abstraction with the popular programming language Java at the top. Both are designed around the "Write once, run anywhere" principle making all programs independent of the underlying hardware. However, the reduced amount of complexity for developers has had a negative impact on the energy efficiency of the applications. Therefore, Google has introduced different improvements to their architecture including just-in-time and ahead-of-time compilation. Furthermore, interoperability with native code written in C or C++ and the new Android RunTime have been added, which improve performance and reduce the power consumption in most use cases.
The specific challenges of green computing can be found in the article about the Android architecture, which also assesses the viability of its advancements.