Fraser Speirs developer at Connected Flow and Head of Computing and IT at Cedars School of Excellence has written an excellent article to clear the misconceptions about iOS multitasking.
Ever since Apple introduced multitasking in iOS 4 in 2010, most iPhone blogs (including us) and even some Apple Geniuses have advised iOS device users to kill apps running in the background (the ones that show up in the multitasking bar) to improve battery life. In fact, we recently showed you how to close multiple apps at a time rather than just one.
Unfortunately, we were wrong. Fraser Speirs writes:
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.
He goes on to clarify:
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.
He then goes on to explain that except in a few cases, the apps runnings in the multitasking bar are not currently running in the background.
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.
He goes on to explain:
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.
Speirs explains that the Suspended apps that are consuming memory are purged and moved to Not Running state when a memory intensive app is launched. So these Suspended apps that have been moved to the Not Running state by the iOS will be removed from the memory and will launch afresh the next time you launch them.
He goes on to reiterate:
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.
Speirs also goes on to explain that when you an app is sent to the Background, it usually moves to the Suspended state within 5 seconds unless the app informs iOS that it is starting a background task. Even in such cases the apps don’t run indefinitely but are given approximately 10 mins by the iOS to finish the background task after which they’re forcibly suspended by iOS.
However, there are 5 kinds of apps that are an exception to the rule:
- Audio: Allowing users to use radio apps like Pandora, InstaCast in the background while they’re using iPhone’s Safari browser to surf the web etc.
- VoIP: This will allow VoiP apps like Skype to run in the background so that it users can receive and make calls even when they’re running in the background.
- Location: Apps that need to constantly track your GPS coordinates can now run in the background while you listen to music or surf the internet.
- Newsstand apps that are downloading new content.
- Apps that receive continuous updates from an external accessory in the Background.
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.
So thanks to this implementation users don’t have to manage Background tasks in iOS. He goes on to summarize:
- 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.
So you don’t need to use jailbreak tweaks to close apps in the multitasking bar or get frustrated about closing them one by one as the iOS is already managing things for you. Users should use the multitasking bar to quickly launch a recently used app.
We think Apple has added to the confusion by calling the task switcher the multitasking bar. Some would also argue that this is not true multitasking as ideally apps should be running in the background and Apple could have reduced the confusion by calling the feature something else. But given the limited resources available in mobile devices like the iPhone, iPad and iPod touch, we think Apple has adopted the most practical approach to ensure it does not adversely impact battery life.
Anyways, we hope this clears the major misconceptions you had about multitasking in iOS and our apologies for the wrong advice. Thanks Speirs for taking time to explain it to us.