Developer Clears Misconceptions About iOS Multitasking

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.

Speirs notes:

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:

  1. If someone tells you that all the apps in the multitasking bar are running, using up memory or sucking power, they are wrong.
  2. 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.
  3. An app may request an additional 10 minutes of Background running to complete a big task before becoming Suspended.
  4. If memory is becoming scarce, iOS will automatically move Suspended apps into the Not Running state and reclaim their memory.
  5. 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.

[Fraser Speirs’ blog via Techmeme]

Like this post? Share it!

  • Kwopau

    Thanks for the info. Good to know.

  • Ed Sellers

    From a developer standpoint, all of the above may very well be sufficient as far as coding your application goes. For most iOS users, it should be transparent and “just work”. However, I think a site like this caters to those of us who want our iOS devices to “just work BETTER”.

    Manually closing apps in the multitask bar significantly improves performance, if not battery life. My devices (especially my first gen iPad) start getting very sluggish after running a few apps – and occasionally crash when launching RAM-intensive apps. I don’t notice as much on my 4S, but I’m sure it is also affected. Manually closing apps in the bar (or using tweaks) and freeing memory brings it back to speed.

    While I’m using a mobile device, I have very little patience for waiting for iOS to decide which apps to transition from “suspended” to “not running” when I’ve pulled my hands out of their warm gloves. I want it to work instantly, not after iOS has leisurely decided which apps it deems no longer worthy of RAM allocation.

    A better way to summerize the article may be that while you may not NEED to close backgrounded apps, you very well may WANT to.

  • Alo

    Cool

  • LG1

    Excellent article, real good info. to know. Question? If by hitting the home button the running app. quits, then the recent tweak Zephyr by Chpwn is a fail?

    Thank you Iphonehacks for all the latest news!

    • http://iphonehacks.com Rounak

      zephyr is more of a smart-switching mechanism, not a task manager. And you would definitely switch between apps a lot

  • Ztrel0cK

    The main question is – how to determine how is a particular app behaving.
    You can run an easiest test: on a device with SBS check available memory and wright it down Run a program (a game, let’s say) that does not use GPS, 3g, WiFi or anything else. Go to home screen, run another similar app or 2. Check your memory – it will go down (usually significantly, depending on the size of the app). So most of the apps are Suspended. It is my understanding that if the app is in the memory – the CPU has to work with allocating and re-allocating the memory, the suspended apps do consume battery. Would love to be wring though =)

  • Rishabh

    i have a question…
    if the apps are not running then what is the use of the close button that appears on the apps when u press and hold an app ?? o.O

    • Weebsurfer

      +1

      • s2kdave

        To stop the app from running if it is running and the remove it from the recently used list.

  • Weebsurfer

    Sorry. A quick search of forums relating to battery issues on the iPhone will show significant stats that indicate this article has some holes. This is the second article like this I’ve read in a week and both tell a story of a perfect world where everything the hardware and software does exactly as its supposed too. Nope. Apples implementation of “task Switching” isn’t as eloquent as is stated. And even then nobody’s going to keep track of which apps are going to be using background resources, etc to know which ones to close. I’ll stick with my jailbreak and “remove background” tweak thanks. As well as “automatic location”. Apples all or nothing philosophy on functionality needs to back te truck up and steal some more good ideas from the jailbreak community. IMHO.

  • http://rock.com Alexrock

    Ok, so I’m at the Genious Bar about a year ago with my iPhone whose battery suddenly, overnight, started dying in a few hours of standby time, and they start closing Apps from the Multitasking Bar and inform me that was my problem. I told them, no, there’s a real problem here, those Apps are not using power, and they said, I’m not making this up, “How do you think they exist if they’re not using energy?” Then, they stood there with a bunch of other customers they had been chatting with, holds their Starbucks cups, literally laughing at, pointing, and overtly mocking me. I told them Steve pulls that attitude off because he is successful, and gave them the old line about their goofy opinions qualifying them for a refund of their tuition, then went to the manager who offered to replace my iPhone. I don’t think he believed it was broke, he just realized his staff let a bit too much of their true opinions known.

    But no, I was suspicious. Why had the phone suddenly started acting like this. Clearly those idiots weren’t capable of figuring it out. So I started messing with it.

    This is where we get to the most important line in this article, the one about what Apps are ‘supposed’ to do and how the App Review process catches errors and offenders. Actually, App Review seems to be the staffing pool for the Genious Bar.

    The reason the myth about Multitasking draining battery power is the quantity of truly crappy Apps which not only mess up battery life in the background but also play havoc with memory and mess up the performance of other Apps.

    Want to test this, get the App “ninjaSteve” which is intended to be a joke. Not only is it a literal joke, but hidden one as well; it’s a demonstration of how bad code can whack things and how bad Apps can get through.

    Give it a try. Then Force Quit!!!

    • marcello

      Alex, you’re taking far too seriously apple stores staff members. most of them are sales attendants with a nice t shirt ON & some knowledge base skills to pull out & quickly sort a question out. (it also depends on the country where you meet them tho still, a bunch of lucky bastards who got on board into a company of many parasites eating from the same cup & sharing it with the mind behind innovation, Steve jobs. until it lasts = until banks, customers, share-holders, financial institutions are going to realize that an unsatisfied customer is representing quite a bit of the market share & driving clients elsewhere. since it’s a large cup at the moment they can afford to take on board mostly useless individuals, (time wasters) & waste their time in the same way they waste time of others.ideally refer to jailbreak community on the internet to understand what the backgrounding iOS feature is like & maybe try backgrounder too, a real BG tweak for iOS available in cydia allowing to unable & disable BG manually & allowing customization of BG behavior or recently used apps list. CONCLUSION:
      do not waste time and energy by getting angry at or frustrated about apple store’s members of staff, we are already working on that by making pressure on Apple board members to change education & training policy also consider, in a difficult moment (the so called recession) employees have to be the crappy ones to save on HR costs. what they do in apple store is a sale, they gather whether there is someone still interested in buying something then , they sell a crap version arguing it’s out of stock or unavailable at that time & , reserve in fact the good one for some good friends. lack of TRUST in themselves all across EU right now.marcello

  • FredMC

    Anyone with [a jailbroken phone] SBSettings (and a compulsion to go in to Processes and kill apps you no longer need, like me) knows the Multitasking Bar is really just a Recently Used collection.

    I was hoping Apple would improve the background handing of apps with iOS5, or add more memory to iPhone 4S to handle them better, but I was wrong.

  • John

    Yes anyone with a jabroke. iPhone cango into sbsettings and see that those apps aren’t necessarily open. However you can also see the list of running process and see that a lot of them are still running in the background. And maybe it’s supposed to free memory of previously used apps but anyone with a 3GS knows you often have to kill background apps in order to free memory so the app your trying to use works.

  • Josh

    Total BS. If your iOS device is jailbroken, use SBsettings to check your free memory. You will note that when apps are running in the background or “suspended” they take up the same amount of memory. I just tested with flipboard, it uses the same amount of memory after 20 minutes of inactivity. The moral of the story: Just because you think you know how it works, doesn’t mean that you know anything. Shut down apps in the multitasking tray for more memory, and shut off your iOS device. These things will clear the memory properly.

    • MFunk

      Totally agree, just tried it.

      • MFunk

        I think the developers need to install SBSettings to see how their software works.

        • John

          Seconded. Yet according to this guy “some” apps run in background mode meaning: the app is no longer on-screen but is still executing code. “some” here meaning “almost all”

    • Evan

      this is what he posted:
      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 cod

      The above indicates exactly what you said – that background and suspended apps still use memory. The issue being addressed is battery life, and memory does not use battery (well dram always uses battery but it uses pretty much the same whether the memory is being “used” or not).

  • http://rock.com alexrock

    Josh,
    Do you work at the Genius Bar?

    It’s about Battery life, he said the memory stayed until iOS takes it back.

    (by the way, I didn’t deserve the pass for that typo!)

  • Darkhose

    So I’m not an expert or anything but if it’s not a true multitasking then isn’t apple doing a false advertising?!!!

    • Ummm Yeah

      its still multitasking. you can use multiple apps at once, e.g listen to radio app and surf the web, facebook, game etc
      but if the app is minimised/closed and isnt doing anything then the OS will stop it running and using power.

  • alonsomosley

    this article does not cover my experience.

    On everyday use of my iPhone 4 I have about 60-80 MB RAm free (SBSettings shows this). If I launch a memory-intensive App (line PerfectlyClear) it tells me I have to little free memory and closes…. I quit all “multitasking” sh*t with RemoveBackground, have 300 MB RAM and can use the mentioned app without problems.

    I don’t beleive this article, or at least state, that the whole concept doas not work as intended.

  • Ummm Yeah

    meh. ill still remove the apps from the background bar when ive finished with them, just more organised.

  • rcas

    I was helping someone with his iPad last month, it was lagging and taking forever to load web pages and apps. I opened the “multitasking” bar and he had 5 rows of apps in there. After removing them from the multitasking bar low and behold the iPad went back to its snappy self. Same thing happens with my iPhone (which isn’t jailbroken by the way). If they’re really not supposed to be running AT ALL after the home button is pressed then apple screwed up big time because all signs point to the opposite being true.

  • Patrick

    Something sounds off… I have my available memory showing in my status bar and why is that when I kill apps from that list I free up memory?

    • A Black Dude

      because the apps are cached in the memory….they arent “running” (using cpu). its saves the state of the app in the memory to keep track of where u left off, like a saved file from a game.

  • Jules

    I have been told by the Genius Bar folk some conflicting answers on many things, so I’m not sure I would trust them to do anything except get me a new piece of hardware from the store room.

    But I would have thought that any extra processing required to manage memory because of a suspended app will use power – probably very little. But if you NEVER close apps from the ‘Multitasking’ bar then I would expect that iOS is spending extra processing time to reallocate memory every single time you use an app. There’s no way that wouldn’t affect power consumption in some way… Perhaps its not that it uses power while simply sitting there locked, but maybe that it uses more power than it should switching or opening apps while using the device. Just a thought…

    However I think Josh’s problem was definitely hardware and the Genius employees at his local apple store are a bunch of douchebags. 

  • A Black Dude

    uh duhhh….apple already explained this when they 1st released ios 4, and have gotten tired of correcting misinformed people on this site.

  • jacquesdupontd

    Anyway , we all know that iphone apps are full of memory leak , that they do consume battery in suspended state and that’s why such a tweak can be interesting but is even not enough , cause for the tweak to be perfect , it should kill all background apps task etc… and just after Free Memory as you can do it in SBSettings . I’m bored about seeing my memory going down and down over the day having to push the Free Memory button + task cleaner . There are indeed a lot of holes in the system and this can be afforded to developpers but mostly to Apple itself . I find this article a lil bit Apple Propaganda don’t you ?

    Jacques Dupont(d)

  • James Fisher

    If someone tells you that all the apps in the multitasking bar are running, ** using up memory ** or sucking power, they are wrong.

    **If memory is becoming scarce, iOS will automatically move Suspended apps into the Not Running state and reclaim their memory.**

    So are the apps using memory when they are in the multitasking bar or not?

    I can tell you that when i open games and apps then close them, i loose alot of memory and it slows my iPhone down! Is this artical true or only half true?

  • J

    That’s why I use springtomize 2 and go app switcher > app handling > hide inactive apps from switcher

  • jc84

    the real solution: 1gb ram, then we would not have as many memoery issues. 2gb and we would not care about memory issues .

  • bafare

    It all depends on how you tell the apps to behave. If you set apps to push notifications and location services they will run on background. Still I always use sbsettings to close all apps in background, and my phone always runs smooth.

  • iBoneless

    Just ran into this article cause i ahve nothing to do today and this is completly wrong! I user came to me the other stating they were no longer getting emails on their iPad and landscape rotation was not working. I asked them if they reset their device and they said yes, after looking at their device they had just about every single app available listed on the multitasking bar, upon closing every single one out which took a while evenafter a 3 to 4 fingers salute, emails and rotation wroked again. So yeah this article… BOGUS wrong info dont believe what you read.

  • SJcloutier

    I’ll apologize up front if this has been written already. However, the assertion that memory is released once the home button is pressed may or may not be accurate.
    I consistently need to close apps from the multitasking bar in order for some of my apps to run correctly. Such as TuneIn Radio, there are times when it will not buffer the feed until some of the apps are closed and the app is reloaded. This happens with some games also. Maybe you can tell me if this is happening because in many instances I don’t use the home button to switch applications. Either way, I do have to manage background apps. At least that’s my experience.