RAM: What it is and when do you need more?

2

oneplus-5-ram-usage.jpg?itok=E4J25opj

Your phone needs RAM to operate, but why? And how much?

It looks like Vivo is going to be selling a phone with 10GB of RAM. That’s almost as much as many gaming PCs, and about 6GB more than most phones. It has a lot of folks scratching their heads and asking why in the world does it need 10GB of RAM, and does that mean my phone with 4GB needs more?

This wouldn’t be the first time we’ve seen phones come with oodles of RAM. The OnePlus 5T has an 8GB configuration, and seeing 6GB inside some phones is becoming fairly common. Let’s talk about what RAM is, how your phone uses RAM, and why a phone would have 250% more of it than “necessary”.

What is RAM

RAM (Random Access Memory) is short-term digital storage. Computers (and yes, your phone is a computer) use RAM mostly to hold data that active applications — along with the CPU and operating system’s kernel — are using because RAM is very fast when it comes to reading and writing. Even the fastest hard drive or flash storage is slow when you need to read or write something “right now”, and while the CPU inside your phone has its own cache to hold data that’s being used for calculations, there’s not a lot of it. The Snapdragon 835 (as an example) has 2MB of cache for the high-performance cores and 1MB for the low-performance cores. 2MB of cache is only enough to hold what’s being used right now, so you need somewhere to hold what’s being used next.

Reading and writing to and from RAM is fast. Super fast.

The OS kernel acts as a traffic cop for everything that goes on when it comes to using your phone’s hardware. When a game or any app wants to draw a new screen, the data is created to use for it goes into the RAM where the OS can parse it, let the CPU and GPU do any processing needed, then send it off to the display, so the right color dots can be drawn in the right places.

It all sounds complicated, and it is, but all you need to understand are three basic things: RAM is a place to hold data for a short period of time, and data placed there can be read or written very fast. Data in RAM is erased when you shut your phone down. A portion of the RAM in your phone is used as soon as you turn it back on and no apps or even the OS is able to use that portion. This goes for just about any computer; they (almost) all have RAM and they use it the same way.

oneplus-5t-ram-usage.jpg?itok=uk9UyDHe

How your phone uses its RAM

RAM in your phone is mostly used as a place for apps that are running store their data. In the simplest terms, that means more RAM can let more apps run in the background without slowing your phone down. But like most things, it’s not really that simple. The RAM in your phone is in use before Android is even up and running.

We’re not going to talk about fancy low-level management or things like compcache here, but this is basically how your phone uses the RAM inside of it.

  • The kernel-space: Your Android phone runs on top of the Linux kernel. The kernel is stored in a special type of compressed file that’s extracted directly into RAM during the device power-on sequence. This reserved memory holds the kernel, drivers and kernel modules that control the hardware and room to cache data in and out of the kernel.
  • A RAMdisk for virtual files: There are some folders and files in the system tree that aren’t “real.” They are pseudofiles written at boot and hold things like battery levels and CPU speed data. With Android, the whole /proc directory is one of these pseudofile systems. RAM is reserved so they have a place to live.
  • Network radios: Data about your IMEI and radio settings are stored in NVRAM (Non-Volatile memory that’s not erased when you power off your phone), but get transferred to RAM along with the software needed to support the modem when you first turn on your phone. Space is reserved to keep this all in memory.
  • The GPU: The graphics adapter in your phone needs memory to operate. That’s called VRAM, and our phones use integrated GPUs that have no stand-alone VRAM. System RAM is reserved for this.

Once that’s done and your phone is up and running, what’s left is the available RAM your phone needs to operate and run apps. A portion of this is also reserved for things that need to happen quickly (low-level operating system functions and housekeeping) but it’s reserved a different way through what’s called minfree settings. These are software-based settings the people who wrote the OS and built the kernel for your phone set, and it keeps a set minimum amount of RAM free (thus, minfree) so these low-level functions can be done as needed without having to wait for an app to free any memory.

All this is why the available RAM listing in settings isn’t the same as the total amount of RAM installed inside your phone. The full amount really is inside, but a portion of it (usually about 1GB or so) is reserved. Your apps get to fight over the rest.

Unused RAM is wasted RAM

cleanmaster-s6-ram-system-ui.jpg?itok=VP

You might have heard this saying about Android and memory management. It’s a Linux thing, and Android is a Linux kernel-based OS just like Ubuntu. What it means is that Android was built to stuff the RAM full of apps and their associated data as fast as possible and keep it full, leaving only the minfree amount from above open for housekeeping duties.

Android is not Windows 10 and they each do things differently.

This is different from the way Windows works, though if you’re using a Mac, it’s very close. Windows keeps RAM open and free for an app that needs it. Linux keeps an app in memory until the memory is needed elsewhere. That’s also decided by the minfree settings the company that built your phone set. Apps and their processes are given a priority based on what they do, how they do it and when the last time they were on the screen. When you want to open a new app, the apps with lower priorities get closed so the new app has the RAM it needs.

As you use your phone, you’ll use many of the same apps more than others. These apps will tend to stay resident in RAM and be running so they are available in an instant. Having that RAM free instead means the apps would need to restart the processes that allow you to interact with them, and that’s slower and uses more battery power than keeping them resident in RAM.

It’s a true saying for your Android (or iOS) phone, but not your Windows computer or Chromebook (also a Linux-kernel-based OS but uses zcache and sandboxing in a very custom RAM management scheme) because they manage RAM differently.

What does having more RAM inside my phone do for me?

You already know the short answer because it’s above — allows for more apps to run in the background. But the long answer is really interesting.

The first Android phone, the T-Mobile G1, had 192MB of RAM. The Pixel 2 has about 22 times more with 4GB.

8GB or 10GB of RAM is complete overkill for a typical Android phone. Phones like a Nexus or an Android One/Android Go phone can get away with 1.5 – 2GB of free RAM after the phone is booted up. So can a Galaxy S8, but only because the minfree settings are set so that the home app (the user interface) is forced to stay open, and uses a portion of the reserved RAM. The Samsung interface is more resource intensive, and Samsung did the very smart thing here starting with the Galaxy S6 and killed most of the home screen lag. Nice work, Samsung!

Using what that tells us, we can see that a phone like the Galaxy S8 needs more RAM installed. Since almost every phone comes with 4GB of RAM, there is no real difference here and a Nexus phone just has a little more memory to have another app or two up and running because it’s interface isn’t using as much. It’s also why Samsung, LG, HTC and others have included ways to kill running processes outside of the minfree settings for the times it needs a little boost in performance. If you kill all the apps you can, apps that were not already in memory will start a little faster.

dex-5042.jpg?itok=72sp9TBY

If you take things a step further and do things like Samsung’s DeX desktop setup, having more RAM can be a big benefit. DeX, for example, could use more RAM set aside before the phone is running for VRAM and have a nice chunk to use itself so other apps or processes can run without being interrupted. And you can even more creative if you’re developing software for a phone with “extra” RAM.

Ideally, a phone with extra physical RAM (let’s say 6GB gives an extra 2GB) could use a device driver that enables DMA (Direct Memory Access) for the user interface. This sets aside RAM at boot just for the home screen, touch input, and anything else that makes your phone uber-responsive regardless of anything else running or going on outside of the RAM set aside for DMA. Are you ready for instant touch response or scrolling? Because that is how you get it.

You don’t need more, but you can always use more.

This would let the kernel manage a portion of the RAM, but in a different way than the memmap parameters set for minfree settings when the kernel was built. Software and the OS still control input and output to the Home user interface, but no app would ever be able to overwrite any of the data in this section of RAM, and the interface would always be ready to act on your input.

Now extend this idea into “game mode” or a desktop solution or any other special way an Android phone can be used. There would still be more than enough RAM for the system to do its thing while that extra RAM is there for playing a software-heavy 3D game without killing all the apps in the background, or putting your phone in a stand or laptop shell to use in desktop mode has the memory it needs set aside only for it to work.

RAM is cheap and having more RAM looks great on a spec sheet

Companies charge a lot for a model with more RAM, but most of that is because it means they have another model to manufacture and another parts list to maintain. The actual chips that go inside the phone only cost pennies when bought at volume. But being able to say your phone has 6 or 8 or even 10GB of RAM when it’s announced can go a long way when it comes to the spec sheet.

It’s impressive, especially to tech enthusiasts and early adopters. I’ll admit, it gets me interested. I like seeing optimized software that can run well on minimal hardware because, to me, it’s an art form; writing code can be beautiful. But I’m also intrigued by what having extra RAM can mean when the two have meshed together in the same device. Seeing 8GB of RAM in the specs instantly gets me interested, the same way a high-resolution display does.

Seeing better specs is a sure-fire way to interest early adopters.

Companies that build phones know this. They also know that putting more RAM in a phone means they can get away with less software optimization (a costly and time-intensive thing) or try and do more with their version of Android. Either way, some of us will be buying only because of the specs. That makes the added costs worth it because people talking about your product is priceless.

This is especially important in the East. Phones with more impressive specs sell better in India and China (the two markets that show the biggest potential for growth in the industry) because more people in India and China want impressive hardware. Catering to your customers is a smart thing.

When this is all said and done, you probably won’t need more than 4GB of RAM for your phone today. That will change as phones start to do more, which is why the Nexus One shipped with 1GB of RAM and the Pixel 2 shipped with 4GB of RAM. But it’s important to realize the potential of a 4 or 6GB surplus of fast digital storage has for new ideas and features. Don’t let additional RAM be your only decider when buying a phone, but don’t write it off as a gimmick.