Misconceptions About iOS Multitasking (Article)

John Yester

Moderator Team Leader
Ambassador
May 23, 2012
8,847
1
0
Visit site
Came across this the other day. It deserves it's own thread. some very SOLID key points written here.


//

Fraser Speirs - Blog - Misconceptions About iOS?Multitasking



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.
Background Tasks

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.
Summary

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.

\\
 

Just_Me_D

Ambassador Team Leader, Senior Moderator
Moderator
Jan 8, 2012
59,784
645
113
Visit site
As I sated in the other thread, what is wrong with closing out dormant apps? I've been doing it since I've had my iPhone and I've experienced no known ill-effects from doing so.
 

kch50428

Well-known member
Oct 22, 2010
21,025
305
0
Visit site
There's nothing wrong with what you're doing D. Do as you wish, it's your phone. I do as you do... Not because I think I "have to" - it's because I want to, and I can.
 

Just_Me_D

Ambassador Team Leader, Senior Moderator
Moderator
Jan 8, 2012
59,784
645
113
Visit site
There's nothing wrong with what you're doing D. Do as you wish, it's your phone. I do as you do... Not because I think I "have to" - it's because I want to, and I can.

Thanks, Keith. Like you, I don't close them out because I have to, but because I want to. It's merely something that I do. Period!
 

BLiNK

Well-known member
Oct 7, 2009
8,225
350
0
Visit site
without digging through the main iMore articles didn't Rene once agree with this then come to the conclusion that one should close them from time to time?

i close them all of the time by the way
 

John Yester

Moderator Team Leader
Ambassador
May 23, 2012
8,847
1
0
Visit site
No

Here is a comparison video done in testing on iPad, but same results on iPhone.

If you have time view it here. Fraser Speirs - Blog - iOS Multitasking in?Detail

You will see in the video and as he explains. The apps that needs access to memory are killed off, or just put on back burner for later access, then after a length of time they are then killed off.
 

BreakingKayfabe

Well-known member
Sep 12, 2008
8,442
53
48
Visit site
without digging through the main iMore articles didn't Rene once agree with this then come to the conclusion that one should close them from time to time?

i close them all of the time by the way

Yes. I remember he agreed on that once. I can't distinctly remember what the reasoning was
behind it. But, in all other cases, Rene is pretty much in agreement with what the article posted
here is telling us.
 

John Yester

Moderator Team Leader
Ambassador
May 23, 2012
8,847
1
0
Visit site
A good refresher, even for me helps.

It was linked to me the other day and felt it needed to be shared. Same still applies to any Apple iOS device in the Market now.
 

BreakingKayfabe

Well-known member
Sep 12, 2008
8,442
53
48
Visit site
I just close out apps from the multi-tasking bar because I'm a clean-freak by nature, lol

I realized how much the apps were in a "frozen" state on iOS when I was using Android
for a while.
 

mjs416

Member
Oct 18, 2011
23
0
0
Visit site
"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."

While I am not overly familiar with mobile iOS architecture - in a PC sense you would be wrong. Unless you terminate a process - it does reside in the background using RAM and CPU power.

No OS is perfect and I find it ridiculous that the user cannot manually terminate programs manually.
 

3cit

Well-known member
Nov 6, 2011
3,044
63
0
Visit site
I stopped killing apps. I would just use the "free mem" from sbsetting menu.
But that was until I got the new switcher tweak jlauncher and now with a long press of the clock I can kill all apps in about a second! So
I'm killing apps like some kind of software Mercenary.
 

Ipheuria

Well-known member
Jul 21, 2009
7,356
239
0
Visit site
Everyone is right in this thread, while the OPost is known there are new members to the forums every day. So a little refresher is always a good thing and I'm sure there are even veteran members who may not know. Yes we are all able to quit apps as we want since it is our devices, and they say Apple doesn't give choice. However I will tell you what I discovered and my own personal approach to this. I found that the OS is written to manage apps and although there is room for improvement if you routinely kill all your apps the battery life is actually worst at least that is what I found on my iPhone 4. When you leave the OS to kill apps the way it's supposed to whether it is effeciency or something else my battery life improved in my case. There are always exceptions to a rule there are apps that start misbehaving and there is also the question of RAM. However these apps are supposed to work the fact that you can't see the RAM being used means that you are just trusting how the OS is supposed to handle things you don't know with a 100% certainty that the memory is being returned.
I can tell you that using a JBen iPhone I had the memory indicator and when things were in the app switcher the RAM didn't return to high levels until I quite some apps. I knew the high memory usage apps like Facebook and mobile Safari so on my iPhone 4 I ran with only 4-8 apps in the app switcher and my memory was always in the 200 MB range. Now that I'm on my iPhone 5 which has 1GB or RAM I run with 12 apps in the app switcher at a time and although I don't have the memory indicator things run snappy and that is all that matters.
So my personal way to do it is apps that are obviously only one time or brief use items like a FollowFriday app which is used only on Fridays or Photo apps/Facebook which I used sporadically I close them when I'm done what I'm doing. Everything else I leave up to the OS to handle but time to time I'll swipe through and if there are more than 12 apps I will kill the ones that I'm not using all the time. This is not THE way to do it, it is my way to do it and that is what works for me.
 

ThePinkChameleon

Trusted Member
Jul 8, 2011
10,864
480
83
Visit site
Like most of you here, my OCD won't let many apps build up in the tray. Like i've stated in another thread, i close out my apps at the end of my day/night. the only ones i do leave in the tray are: settings, phone & messages. I can add which i did not mention before, is after using TuneIn radio and TapaTalk, when i'm finished each time i do go right in and close those ones out.

So many times we've discussed this in the forum, and either way, whether its beneficial or not, everyone is going to manage their phone how they feel fit to do so. Me? I will continue to do my end of day close-outs with leaving the 3 i mentioned above always in my tray. :)
 

Latest posts

Trending Posts

Members online

Forum statistics

Threads
260,349
Messages
1,766,517
Members
441,240
Latest member
smitty22d2