Android A to Z: Multitasking

Multitasking is a word you'll hear a lot around here and at other places on the Internet that talk about smartphones or other tech. It doesn't mean what it used to, back when dinosaurs with long beards first dreamed up computers, but it still makes a very big difference for some folks and can be the deciding factor when picking a smartphone operating system. Let's have a look and see what the fuss is all about, and how it relates to Android.

A long time ago, in a laboratory far, far away, some Jedi masters decided that computers should do more than one thing at a time. They really already were doing plenty of things behind the scenes, but to the user it was a case of entering a command, and waiting for it to finish. Using threads and schedulers, and probably a little magic and a lot of luck, engineers were able to work up an operating system that could run more than one user command at a time, and multitasking was born. When you switch to a new VT (virtual terminal) on a Unix box with no GUI, you're multitasking. When you have more than one window open on your Windows or Mac or other computer that does have a GUI, you're multitasking. You're doing more than one thing at a time, and the computer is running more than one user task at a time. You can now read Android Central while your completely legal torrents are downloading in the background.

On a smartphone, multitasking is a bit different. We don't have the luxury of a 20-inch monitor, so showing more than one "thing" running at a time isn't a big deal. Samsung is testing the waters and trying it with the Galaxy S III with the Pop-Up Play feature, but for the most part whatever we're doing takes the whole screen to do it. We also don't have tons of RAM and video memory available and have to watch the power usage. This means smartphone multitasking has to be a bit, well, smarter.

Smartphones have been multitasking for a long time. All the mobile operating systems do it a bit differently -- some suspending all other apps in the background, some saving the state and closing the app itself, and others just letting everything run. The way Android does it is to let threads and processes run depending on their priority. If you're using Google Play Music, the processes that make the sound come out of the speaker have a high enough priority to stay running when you switch away from the app. Not all of it is running in the background, but enough of it is to keep the tunes playing. Other apps can be killed if they aren't being used, and some apps get "frozen" (for lack of a better word) and restore themselves when brought back to the foreground. What's important, and prioritized, is decided when the application is written and compiled so the end user doesn't have to worry about it. It's not perfect, but it follows the very strong multitasking model from Linux and tweaks it for Android. It's all open-source, so manufacturers and ROM builders can (and have) tweaked things to allocate memory the way they want it allocated. Sometimes the tweaks are great, sometimes not so much.

In the end, remember the next time you open an app and start up where you left off that you're seeing multitasking at work.

Pages

Multitasking is very hosed on the One X and the Evo LTE where it is often more like just "task switching" (as had been done for many years in PalmOS). Many times it is doing more of a "suspend and reload". :( Never acted like that on my Evo OG, Evo 3D, or Nexus Xoom.

> "In the end, remember the next time you open an app and start up where you left off that you're seeing multitasking at work. "

No, not necessarily. For multitasking, as defined by computer scientists, it must have all the apps resident in memory (real or virtual), and actively able to run simultaneously (in the background and/or foreground). The *app* can choose to sleep. The OS can even cause the app to sleep in certain situations. But just because you can choose a previously run app and it can reload and point to what it was doing before, that does not mean you are truly "multitasking". Multitasking requires two or more applications to be able to run at the SAME TIME.

Can you write a more detailed part on dedicated video ram and how it also affects multitasking?

Example, the HTC Hox on ATT uses the S4 which the Adreno takes up around 350 mb of ram which hinders multitasking after Sense has its way with your available memory. The international Hox, Tegra 3, has it's own dedicated video ram and therefore does not take any ram from the SoC.

In comparison, my friend's International Hox was able to open about 4 to 5 more apps than my ATT Hox before it too froze programs into space.

I've been pointing this out to other users in forums. Thought you would be the guy to investigate and write up on it.

If this is truly a video RAM thing, I'm starting to think that Samsung actually did their homework while HTC completely ignored what was going on.

I -highly- doubt Samsung simply threw in 2GB of RAM to have as a marketing point. For most people that doesn't mean anything, plus you have the most popular cell phone, at least for Android - you don't need a gimmick.

Samsung realized it needed more RAM to work and did it. HTC ignored it and we're where we're at now.

Portions of this page are modifications based on work created and shared by the Android Open Source Project
and used according to terms described in the Creative Commons 2.5 Attribution License. AndroidCentral is an independent site
that is not affiliated with or endorsed by Google.