Ever since Apple introduced multi-tasking on their iOS devices, there has been an enormous amount of confusion among users of these devices as to how it actually works. I cannot tell you how many times I have heard people say that they are going through their apps and closing them to save battery, speed the phone up, etc. I’ve even heard Apple employees tell this to customers who come in saying they don’t get the battery life they want out of their iOS device. Well I have come across two articles that explain everything you need to know about iOS multi-tasking and the force quit fallacy. Once you read through these articles, you will be extremely well versed in iOS multi-tasking. Enjoy!
The Force Quit Fallacy – Read article on MartianCraft.com
Misconceptions About iOS Multitasking via Speirs.org
There is one iOS “tip” that I keep hearing and it is wrong. Worse, I keep hearing it from supposedly authoritative sources. I have even heard it from the lips of Apple “Geniuses” in stores. Here is the advice – and remember it is wrong:
“All those apps in the multitasking bar on your iOS device are currently active and slowing it down, filling the device’s memory or using up your battery. To maximise performance and battery life, you should kill them all manually.”
Wrong. Wrong. Wrong. Wrong. Wrong. Wrong. Wrong. There are caveats to this but anyone dispensing the advice above is clearly uninformed enough that they will certainly not be aware of these subtleties. Let me be as clear as I can be:
“The iOS multitasking bar does not contain “a list of all running apps”. It contains “a list of recently used apps”. The user never has to manage background tasks on iOS.”
Except in a few cases, which I’ll explain, the apps that appear in the multitasking bar are not currently running. When you press the home button, iOS will tell the app to quit. In almost all cases, it quits, it stops using CPU time (and hence battery) and the memory it was using is eventually recovered if required.
Let’s get technical: iOS apps have five states of execution. These are:
- Not running – the app has been terminated or has not been launched.
- Inactive – the app is in the foreground but not receiving events (for example, the user has locked the device with the app active)
- Active – the normal state of “in use” for an app
- Background – the app is no longer on-screen but is still executing code
- Suspended – the app is still resident in memory but is not executing code
Active and Inactive are not interesting for this discussion. Most of the confusion is around what happens as an app goes from Active to Background to Suspended to Not Running.
When you press the home button, the app moves from Active to Background. Most apps usually then go from Background to Suspended in a matter of seconds. The first technical caveat is that Suspended apps remain in the device’s memory. This is so they can resume more quickly when you go back to them. They’re not using processor time and they’re not sucking battery power.
You may think that, if an app is resident in memory, you have to somehow remove it to conserve memory. You don’t because iOS does it for you. If there are Suspended apps lying around and you launch a memory-intensive app such as a big game, iOS will start to purge Suspended apps and move them to the Not Running state. That is, they will be completely removed from memory and will launch afresh the next time you tap their icon.
Where some people get confused is this: all of the above has no impact on what you see in the multitasking bar. The multitasking bar always shows a list of recently used apps, regardless of whether they’re in the Background, Suspended or Not Running states. You may also have noticed that the app that is currently Active does not appear in the multitasking bar.
When an app is sent to the Background, it usually moves to the Suspended state in a few seconds. An app can request an extension to this by declaring that it’s starting a “background task”.
A good example is an app that downloads largish files from the web such as Instacast, my favourite podcast app. When Instacast is Active, it can start to download new podcasts. If I then hit the home button on my iPhone, Instacast gets five seconds to run in the Background state and then it’s Suspended. That interrupts the download of my podcasts, which might take 5 minutes or more.
iOS allows Instacast to declare that a download is a “background task”. This allows Instacast an extra period of background running after I hit the home button to complete the podcast download. While apps can request additional Background time, that time is not infinitely long. The app gets about 10 minutes of Background running time and then it is forcibly suspended by iOS. Again, you don’t have to worry about this yourself.
Indefinite Background Running
All apps get 5 seconds of Background running. Some apps can request a 10-minute extension. There are a small number of apps that genuinely need to run indefinitely in the background and iOS allows this. There are exactly five kinds of apps allowed to run indefinitely in the Background state in iOS 5:
- Apps that play audio while in the Background state. A good example is Instacast while it’s playing a podcast.
- Apps that track your location in the Background. For example, you still want voice prompts from your TomTom navigation app, even if another app is Active.
- Apps that listen for incoming VOIP calls. If you use Skype on iOS, you can receive incoming Skype calls while the app is in the Background.
- Newsstand apps that are downloading new content.
- Apps that receive continuous updates from an external accessory in the Background.
All well-written apps in the above categories should become Suspended when they are no longer performing the task in hand. When Instacast finishes playing a podcast, it should be Suspended. There are some built-in apps that also run continuously in the background on iOS – the most-used one is probably Mail.
As long as these apps are running in the Background state, they will consume memory, CPU time and power. In general, though, you would know that you were using such apps. The developer has to declare which category of Background running they require and part of the App Store review process is to check that these declarations are not being abused.
I said earlier that “the user never has to manage Background tasks on iOS”. The only exception to this is when one of these Background-running apps goes berserk and will not terminate properly. That, however, is an exceptional situation and not a normal part of being an iOS user.
Let me wrap this up by giving you a quick summary:
- If someone tells you that all the apps in the multitasking bar are running, using up memory or sucking power, they are wrong.
- When you hit the home button, an app moves from Active to Background and quickly to the Suspended state where it no longer uses CPU time or drains power.
- An app may request an additional 10 minutes of Background running to complete a big task before becoming Suspended.
- If memory is becoming scarce, iOS will automatically move Suspended apps into the Not Running state and reclaim their memory.
- Five classes of apps – audio, GPS, VOIP, Newsstand and accessory apps – and some built-in apps such as Mail may run indefinitely in the background until they complete their task.
Put simply: you do not have to manage background tasks on iOS. The system handles almost every case for you and well written audio, GPS, VOIP, Newsstand and accessory apps will handle the rest.
Also available in audio format