RAM manager

Recently, a wise man holding a new Samsung Galaxy S II made a great observation --

Why, in the name of all things holy, does the fastest, most powerful phone on the market have a widget warning me how many apps are open?

Many of you guys know me, and how I am (if you don't, imagine some godless mash-up of anal retentiveness and OCD), so you know this is something that just had to be addressed or I would never sleep well at night again.  Which leads us to here and now.  The answer to the question is pretty easy -- user madness and FUD forced manufacturers to add some sort of RAM-cleaning, task-killing, and problem-causing widget to current builds of their software.  For most of us, the system running on our Android phones, and the way it handles RAM usage, is very different than what we are used to on our computers.  If we take a few minutes to understand the way RAM is managed on our phones, we'll not only be able to better interpret what that widget is telling us, but also understand why it doesn't really matter.  Let's do that, after the break.

The 'Task Killer' debate

RAMbo VIII -- Cory's about to kill something Every discussion about Android phones and tablets, and how they manage memory will eventually get to the Task Killer debate, so we're going to start with it.  Simply put -- task managers are good; task killers are bad.  In the hands of someone who is aware of what will happen when they stop a running application, a tool that easily lets them do it is a fine thing for everyone.  It's a function built into every operating system, including Android.  It's a useful debugging tool, and great for developers and power users alike.  The problem is that if you're here at Android Central reading, you're either a power user already, or a power user in training and understand more than most people who just install TASK KILLBOT 2000 because the Market description said it will make your phone ZOMG FAST.  You realize that killing the Mail app will stop you from getting mail, or that killing the system clock will make you late for work.  Harriet Housewife, who just picked up her shiny new Android phone at the Verizon store doesn't -- and she doesn't have to -- unless she gives in to the FUD (or worse, some kid at a store who thinks task killers are a gift from Zeus himself) and installs the task killer.  It's not her fault though, as it seems like every time you turn around someone, somewhere is saying that to get good battery life and ZOMG FAST you need to use one. 

You don't.  You won't.  And it makes Cory twitch a little and think about ammunition and clock towers.  Keep reading. ...

What is RAM?

RAM

RAM (Random Access Memory) is storage used for a place to hold data.  Think of it as a big filing cabinet that keeps things ready for the CPU in your phone to present it to your eyes and ears.  It's infinitely (almost) re-writable, very fast, and used differently by different operating systems.  Many of you guys understand what it is, how it works, and what I'm explaining -- but we're going to try and break it down so that more normal and well-adjusted people can follow along.

RAM is used for one reason only. Reading and writing to file storage (as in reading and writing to your hard drive in your computer, or your internal memory/SD card on your phone) is terribly slow.  Solid-state "disks," like what's used in our Android devices and what a lot of geeks people use as hard drives in their computers, are faster than spinning disk platters (normal computer hard drives), but using it to cache the data we need is still a lot slower that using dedicated, solid-state RAM.   RAM is cheap.  The bus (a pathway for the electrical signals to travel along) between the CPU and the RAM is fast, and everything is kept orderly and easy to retrieve.  It's also resource friendly to read and write to it.  Without it, computers of all sizes would suck a lot more.

Running applications

OMG! It's red!  RUN RUN!!!!!11111

Widgets and apps that monitor the apps "running" (quotes intended) aren't inherently evil.  We're going to pick on Samsung here, but Motorola, HTC, and the rest all do the same thing in different ways.  And what they are doing isn't inherently bad -- people have been using tools like Torsmo and Rainmeter to show a fancy graph of their RAM right where they can see it for a while, and nobody has been hurt (yet).  But when that little widget turns bright red like it's screaming "Danger, Will Robinson!" with no explanation, it's time to step in and try to explain the process. 

In Android, like many other operating systems built from Unix roots, all share one common thing about RAM:

Unused RAM is wasted RAM

Android, like Mac OS and Ubuntu, wants to use all the RAM it can, because that's how it was designed to work.  There are settings (in Android we call them "minfree" settings) to tell the system how much RAM to leave free and available, but the rest is designed to fill up as fast as possible and stay that way.

You're probably thinking "What's it filling up with?"  That's a great question.  After the system, graphics, radios, and any other tweaks to RAM are done loading, the rest is there to load apps into memory, right up to the point where the OS says to stop.  Load the app as it's being used, and keep it there for the next time until it needs flushed to free space for something else.  The more you use the system, the better it gets at keeping the right things loaded and ready to go.  Think about how you use your phone -- you might have 100 apps installed, but there are a few you always are opening and using.  Eventually, most of those apps will be stored in your RAM, simply because you're always opening them and loading them into the RAM if they weren't already there -- and "erasing" other apps that were there first.  Loading an app from your storage takes longer, is harder on the battery, and overall worse than loading it from it's cached position in RAM. 

Consider this -- Jerry did/said/thought something that made his wife mad (yes, she can read my thoughts), so he bought flowers from the 7-Eleven and wants to make a mix CD of her favorite Rod Stewart songs to give to her and get his ass out of the doghouse.  It could happen.  Consider which is more efficient:

  • Burn 20 songs to a CD, give to wife, and smile while she plays it.
  • Burn one song to a CD, let her listen, then erase it and burn the next song.

That's what your phone (or tablet) has to consider.  Loading Google Talk to RAM once, and having it there to open almost instantly is far better than loading it each and every time you want to use it.  So why kill it off?  It's not like you'll never use it again, and nothing else is going to use that RAM while it's sitting empty -- at that point, it's wasted space.  You will also use a lot more battery power re-opening Talk every time you get a message than you will by having the zeros held as ones on your RAM.  The folks who built Android really did know what they were doing when it comes to memory management.  After the parameters are set, and the amount the OS can use to "swap" for it's normal operations, the rest is simply wasted if we're not using it.  What is cached in RAM is just sitting there, not using any CPU cycles, but ready to get pushed to the front and appear on the screen as fast as it can, and not use the extra battery needed to start it up from disk again.

But Task Killers and freeing RAM made my <insert old Android phone> better!

?!?Having 4MB of RAM made old Windows 3.1 computers better, too.  Android, and the hardware it runs on, evolves in our hands -- it gets better with every new release.  The software is better, the hardware is better, and the folks writing the apps are getting better at it with better tools.  We're going to use the HTC Hero as an example here, because we don't talk about the HTC Hero enough anymore. 

By today's standards, the hardware and the software on the Hero suck.  It sucked the same when it was new, but at the time we didn't have Bionic's or Thrill 4G's to compare it to.  We only knew that there were three ways to make it run faster -- yank HTC Sense off of it, use a task killer, or tweak the system a whole helluva lot.  Two of those options need root access -- so that puts 90+ percent of users out of the picture.

Normal people don't root their phones, and Harriet Housewife (or Tommy Textgod) are normal.  They bought a phone that could do more than any other phone they ever used before, so they tried to do it all.  Android and HTC Sense weren't near as good at managing themselves and their memory needs back then, and having the RAM full meant that there wasn't quite enough left over to run the user interface as fast as it did when the RAM was empty.  Hackers soon found that tweaking the existing settings that decide how much RAM to keep free did a wonderful job at fixing that issue, and we all were happy.  But if you didn't want to hack your phone, you had the option of just living with it being slow every once in a while or using a task killer to free up some RAM.  I'll bet most people just lived with it (the number of people who installed a task killer is waaayyy smaller than the number of people who bought an old Hero, Eris, Cliq, or Behold), but people who spent any time on the Internet fell victim to the lure of a task killer.  Soon, forums across the web filled with tales of woe about things not working right -- because everyone was randomly killing off important system processes and apps that needed to stay running.

There were also issues with apps.  A correctly coded app that uses a ton of resources, let's say Plants vs. Zombies, gobbles up a bunch of your RAM while you're using it, but gracefully exits and purges itself when it's done.  That means the RAM is free, being wasted, and needs filled up again when you load up Google Talk.  When you're done chatting, Google Talk just gets sent to the background because it didn't have to take a ton of RAM and should stay loaded for the next time.  When Android was shiny and new, a lot of apps that used an excessive amount of system resources didn't exit gracefully, and the OS struggled to purge RAM and load itself back to the foreground -- causing lag when you closed a big app.  Sometimes the lag lasted a while, and people soon tired of it.  Killing every damn process you can and jacking the free RAM up as high as possible, or even worse -- scheduling a task killer app to do it automatically every so often -- seemed like the best solution to a whole lot of people.  We're mostly past that now.  App developers are crafty, and the tools they have at their disposal mean that most of the time they get it right -- even on the first try.

Why it no longer matters

Triforce!

Nowadays, the hardware in our phones is amazing and the software is very much improved.  Android can manage memory rather well (and the settings are still there to tweak if you just have to touch stuff) and having up to 300 percent more RAM makes a huge difference.  There will be a few times where killing off a handful of tasks will speed things up, but overall you'll get the best performance out of your phone or tablet if you stop worrying about it and let Android be Android.  If you need to live on the edge (and I know a lot of you guys do) root and hack your phone with some amazazazing custom ROM that has everything tweaked and allows you to travel forward in time -- I'm right there with ya, cause it's fun as hell.

But don't worry about how many apps are running on your phone, or about using widgets that tell you these things, because it just doesn't matter anymore.  We can't blame OEM's like Samsung for doing it -- it was inevitable with all the brouhaha out there, and some may even say necessary with earlier phones.  I promise, this just isn't going to happen:

 

too many cards