“They’re called little jitters or janks, or just stutters in the interface,” said Gabriel Arellano, an Android user and computer science graduate student at The University of Texas at El Paso. “And they tend to happen at the most inconvenient times.”
Yet, since he’s installed Snappy, a system he helped create, Arellano hasn’t been experiencing those annoying little splutters anymore.
Snappy was developed by UTEP’s Robust Autonomic Systems, a group led by Eric Freudenthal, Ph.D., associate professor of computer science.
“Our approach is biologically inspired. Biological systems – like humans – are autonomic, which means self-regulating,” Freudenthal said. “For example, our heart rates automatically increase when we exercise. Smartphone apps and their resource requirements vary widely, and Android’s regulatory systems did not proactively respond to these variations.”
All smartphones come with a set amount of memory. Hundreds to thousands of blocks of memory are consumed each time an app responds to a user’s action – such as when a user scrolls the screen, loads a webpage, takes a photo or plays a game. Some blocks of memory are needed for long periods of time (seconds to hours), others for just a fraction of a second. Since the total amount of smartphone memory is limited by the device’s RAM size, (typically to between 512 MB and 2GB), it is important to recycle unneeded blocks.
Traditional approaches to managing memory require programmers to specify when a block of memory is unneeded. This tracking of needed memory blocks makes programming complicated, and app developers appreciate that memory management in Android is automatic. The process of automatically differentiating needed and unneeded blocks is called “Garbage Collection” (GC).
GC is both time-consuming and energy-intensive, and must therefore be scheduled judiciously. If GC is scheduled too late, an app can run out of memory and pause until GC completes. According to Freudenthal, “GC time is 10 times longer than a noticeable pause, and it’s these pauses that can make an Android device seem unresponsive.” Alternatively, energy, a precious resource on battery-powered devices, is wasted if GC is scheduled too early.
“A premature GC can consume a similar amount energy but yield fewer recycled memory blocks, and therefore the total number of GC operations will increase,” Freudenthal said.
The problem Freudenthal’s group detected was Android’s policies for scheduling GC, which determined the amount of memory allocated to an app based on fixed thresholds assuming a particular rate of memory consumption. They observed that this policy worked out badly for several popular apps that consume memory at rates different from Android’s implementer’s assumptions.
To fix the problem, they modified the operating system’s code to adaptively change the amount of memory allocated to an app and the conditions under which a GC is scheduled based upon app behavior.
Google’s unusually permissive open-source policies proved invaluable for the team members, who are now running Snappy on the their phones with instrumentation enabled. They watch for pauses and analyze data collected in order to quantify their improvements to phone responsiveness and energy consumption reduction. Early results are promising.
“We think it makes for a far better experience,” said David Pruitt, a computer science graduate student who helped lead the project.
Freudenthal hopes Snappy will help establish UTEP as an innovator in autonomic systems. He also hopes that these same principles can be used to reduce energy consumption by the massive data centers that implement the web of Internet services that are increasingly essential components of our economy and social lives and consume 10 percent of the electricity generated in the United States.
The Snappy program is device-neutral, and versions are available for free download by anyone who owns an Android operating system and wants to try it. Keeping with the open source philosophy, Snappy’s source code is also available for download, enabling adventurous users to compile ROM images for different devices and even further improve upon the researchers’ work. Freudenthal warns those trying Snappy to first become informed of the risks associated with replacing a tablet or cell phone’s operating system.