iOS multitasking explained, again

by Justin Horn on Apr 19th, 2010 @ 11:51 am

Related Post: Almost 2 years after I wrote this post, the debate continues. Here’s a great post from Fraser Speirs, backing up my point (aka the truth), “iOS Multitasking in Detail”

There is a lot of confusion surrounding iPhone multitasking. John Gruber of Daring Fireball kicked off the latest round of debate with his article Mobile Multitasking. After reading his article and others like it, I decided to jump into the OS 4 multitasking write-up game.

Most of the multitasking talk centers around the fast app switching dock. I’m going to cover that later, but before we get there I want to review the different app states:  closed, suspended, and background.

Closed State Apps

This is how apps work prior to OS 4. When leaving an app by pressing the home button, the app gets about 5 seconds to finish what it’s doing and save any pertinent info. The app is then purged from memory. Currently, all third party apps running on OS 4 beta still operate this way because they haven’t been updated yet. Even though apps returning from the closed state have to load from scratch, they can use the saved info to start right where you left off. The ability to read / write state data to the app’s own disk space is not handled by the system, but the app itself. This is why you already see this save state in current apps like Rolando, with its “iSave” feature, which lets you resume your game right where you left off.

Suspended State Apps

This is a new state introduced as part of OS 4 multitasking and available only on the latest (and future) iPhone and  iPod touch models. When a user leaves an app, it’s put into the suspended state instead of closing it. The apps are held in memory and their process kept alive, but are given no CPU time. You can think of them as cryogenically frozen, they still exist and are alive, but can’t do anything until defrosted. Restricting the CPU usage in this way keeps the iPhone from getting bogged down, and more importantly, keeps battery usage close to zero. When returning to suspended apps, they start exactly how you left them without needing to load again. This gives you the feeling they were running the whole time. As nice as this sounds, it’s not truly a background app. No CPU means it cannot process any data in the background. For example, after leaving a Twitter app, it’s no longer updating your stream. When returning to the app, all the latest tweets will need to be downloaded. As most OS 4 compatible apps will fall into this category, it means push notifications are still going to play an important role in iPhone multitasking.

Background State Apps

This is a special state, applicable only to certain types of apps. These are true background apps given CPU time while working behind the scenes, but are only able to use resources to perform a specific task. I think the easiest way to explain this is to discuss the details of how a few apps work.

UPDATE 6.25.2010 Added TomTom example for background navigation.

Pandora (Background Audio)
You are jamming with Pandora as you always have, but then decide to check out a band’s website. You press the  home button to leave Pandora and fire up Safari. As a background audio app, Pandora is not put into the suspended state, but remains running as long as it’s streaming audio. When running in the background, the app must only use system resources to process the audio stream. For example, when a song changes, Pandora will not update the screen view to show the new artist info, as this would be a waste of CPU resources for something the user can’t see. A task like this can easily be taken care of when you return to Pandora as it’s moving from the background to the foreground. So after an hour of rocking out with Pandora you notice your battery is getting low, how do you stop it from running in the background? Easy, the same way you do now with the iPod app, just go into the app and hit pause. The only way Pandora is allowed in the background is if there is music streaming, so this time when you leave the app it’s sent to the suspended state.

The multitasking update is currently available [iTunes]

Skype (Background Voip + Background Audio)
There are two different scenarios when dealing with voip: waiting for a call and on a call. Apple’s solution when waiting for a call is perfect for keeping battery usage to a minimum. After logging into Skype and returning to the home screen, the app is not kept in the background like Pandora. Instead Skype enters the suspended state and lets the system monitor its connection to the voip server. When a call comes in, the system moves Skype from the suspended state to the background state. Skype does not automatically open, it’s still only in the background, so what you are currently doing is not interrupted. The call data is then processed and a local notification (another one of the 7 background APIs) is created to alert you a phone call is coming in. If you ignore the call, the connection is handed back to the system and the app returns to the suspended state. If you pick up the call, the app opens in the foreground and the call is connected. If you decide your buddy is boring and you want to check some email while pretending to listen, it’s no longer an issue. When you open up mail, Skype continues to work in the background, very similar to the audio apps. When the call ends, Skype hands the connection back to the system and goes to sleep. To close Skype, just open the app and log out.  When leaving Skype with the voip server connection closed, it goes into the suspended state until you login again.

Facebook (Task completion)

This is a hypothetical example of how Facebook could work if programmed to do so. You are finished playing around on Facebook and just waiting for a bunch of pictures to upload. You leave the app and return to the home screen. Instead of immediately suspending the app, cancelling all your uploads, it requests extra time to finish in the background. When the upload is complete, the app is then put into the suspended state.

TomTom (Background Navigation)
Receiving a phone call while navigating is no longer a problem on iOS 4. Now when you take a call, the app will popup request your permission to continue navigating in the background. If granted you will still receive turn by turn direction while on the call. This also works if you leave the app to do something else, like check email (hopefully you aren’t the driver). The app continues to track your current location, but to save battery it’s not updating the map. When you return to TomTom it will take a few seconds to reposition you on the map. What happens when you’ve arrived and want to shut it off so it doesn’t drain the battery? No, you don’t need to manually task manage and force close. When you reach your destination and are no longer navigating, it will automatically stop using the background navigation and go into regular suspend mode when you leave the app. If you leave the app while still in navigation mode and disconnect from power, you’ll soon get a local notification popup asking if you would still like to navigate in the background. Tap no and send TomTom into suspend mode. You can always confirm that it is no longer running in the background by looking for the new GPS arrow icon (see picture below)…if it’s gone, it’s not navigating.

The multitasking update is currently available (Read More) [iTunes]

What is the fast app switcher dock?

The fast app switcher, or hidden dock, is a new task bar that slides up from the bottom of the screen when you double tap the home button. The new dock doesn’t just list your background state apps that are actually running, but contains ALL the apps you’ve opened no matter which state: closed, suspended, or background. To the end user it doesn’t really matter if the apps are technically running or not; I guess that’s why in the OS 4 keynote Steve Jobs said “I can just double click the home button…and the window raises up and it shows me all the apps that are running.”  The apps are ordered left to right by most recently used, so you have quick access to the apps you use most.

Wait, wasn’t double tap home button a shortcut for my phone favorites, iPod, or Camera?

Yes, it was. To perform the home shortcuts on OS 4, you just need to double tap and hold. Might be confusing at first, but should catch on pretty quick.

UPDATE This double tap and hold was removed from the final iOS 4 release. There is a new feature for controlling the active audio device. To access this you bring up the fast app dock and move left (see picture). Unfortunately the favorites we all know and love are no longer available.


New active audio widget

Is the fast app switcher dock a task manager?

You’ll remember this question for the OS 4 keynote Q&A session:

Q: How do you close applications when multitasking?
A: (Scott Forstall) You don’t have to. The user just uses things and doesn’t ever have to worry about it.
A: (Steve Jobs) It’s like we said on the iPad, if you see a stylus, they blew it. In multitasking, if you see a task manager… they blew it. Users shouldn’t ever have to think about it.

(via Engadget)

You can manage your apps manually in the hidden dock by removing them, which sends them to the closed state, but what Steve said still holds true…the users don’t have to think about it. A regular user on OS 4 can get along just fine without closing apps manually or even looking at the hidden dock at all for that matter. All the operations of managing the apps for memory and CPU concerns are taken care of automatically by system, so there is no advantage to closing them yourself. Another important factor is the ability to close apps (stop background processing) through the app’s user interface, like the Pandora and Skype examples earlier. I assume this will be a requirement for every background capable app1. If not, then what Jobs said is no longer vaild.

UPDATE 6.25.2010 1Some apps, like Pandora, close in a very intuitive way…stop the music, stop the multitasking. Other apps need a bit more thought, but properly designed, they won’t need specific close buttons in the user interface.  A perfect example of this is the TomTom app I recently added to the background state apps above.

How does OS 4 decide when to close apps?

When a new app is opened that requires more memory than is currently available, OS 4 automatically closes suspended apps in least recently used order. The next time you open an app that was closed by the system, it will need to load again just like it does on OS 3.x. You will lose the quick start up, but if the system closed it you probably hadn’t used the app in some time anyway. If even more memory is required, the system starts closing background apps (like Pandora) in the least recently used order.

Apple’s first step into multitasking looks great to me! Their strategy will automatically grow with the hardware. For example, when the 4th gen iPhone is released with 512MB of memory (I love speculating [no longer speculation, I was right]), it will be able to keep more simultaneous apps suspended / backgrounded. Also, as the hardware improves, additional APIs could be added to allow a wider variety of apps to work in the background.

Follow me on Twitter @justin_horn



View 37 Comments
Featured post, iOS 4, iPhone, Speculation

Comments

    1.
  1. Alexis
    May 2nd, 2010 8:15 pm

    thanks so much for this article…I now understand how it works and so greatly appreciate your time making this article

    cuz I have been going and closing apps on a regular basis because I was afraid they were running down my battery…but I think my battery is running down cuz I use my phone more than I used to…cuz I love showing people OS4…it’s hot

  2. 2.
  3. [...] like my wild speculation in my multitasking article back in April was correct: Apple’s first step into multitasking looks great to me! [...]

  4. 3.
  5. [...] when you arrive at your destination or are not navigating the app will automatically stop using the GPS in the background and go into regular suspend mode. If you leave the app while navigating and unplug from power, you [...]

  6. 4.
  7. Martin
    September 7th, 2010 12:54 pm

    I sum up what you said: apps that are in background are suspended and don’t use battery anymore, but as we know, backgrounded apps use RAM so it has to drain battery coz when RAM is busy it uses battery a lot

  8. 5.
  9. Justin Horn
    September 7th, 2010 3:06 pm

    Martin, when the data is just sitting in RAM and not being accessed it uses an immeasurable about of battery.

    What uses battery is moving data in and out of memory from the flash storage and, most of all, the CPU. It actually saves better by not having to load apps in an out of RAM every time because the data is already there, plus it doesn’t need the CPU process all the data and load up the app again.

  10. 6.
  11. ThomasM
    October 12th, 2010 11:36 am

    Hi guys, and thank you for the article. Unfortunately I do not even have the multitasking bar showing. I double tap, double tap and hold, change my settings and so on… I’ve never seen this great feature. Any ideas?
    Cheers from Germany,
    thomas

  12. 7.
  13. Aidil Sharizaq
    November 5th, 2010 8:43 am

    Thanks for this post. I’m using ios4 on my iPad currently. And worried that apps showing in the hidden tab will drain my iPad’s battery.

    If this is the case, I don’t have to worry about going there and closing apps. Just hope that what you wrote in the post is based from a reliable source. No offense.

    Thanks.

  14. 8.
  15. Justin Horn
    November 5th, 2010 9:16 am

    Thomas, only the 3GS running iOS 4 or higher can multitask.

    Aidil, I researched everything from the iOS documentation provided by Apple.

  16. 9.
  17. [...] iPhone OS 4 multitasking explained, again [...]

  18. 10.
  19. J Ham
    November 25th, 2010 3:57 pm

    Excellent – helpful article. Thanks! The technojungle is so crowded with words – your thought organization is super which makes your comments so helpful!

  20. 11.
  21. Kevin
    December 8th, 2010 9:36 am

    Nice article, but it repeats an Apple myth.

    The fast-app-switcher-bar is indeed also a task manager: it has the functionality to kill apps, which is handy especially with older apps that might malfunction under 4.x.

    What Jobs really meant was “In multitasking, if people realize that it’s a task manager… you blew it.”

  22. 12.
  23. Justin Horn
    December 8th, 2010 10:03 am

    Kevin, you are missing the point.

    Yes, you can kill 3rd party apps with the fast app bar, but there is no reason to do that. It is handled automatically by iOS. Basically Jobs is saying you’ve failed if you leave it up to users to manage system resources.

    Like you pointed out, the only reason you would need to force quit an app is if it half crashed or something and got stuck in a weird state. You could then use the fast app bar to kill it, or just enter the app, hold power button down until the off slider appears. Then press and hold the home button (same as iOS 3.x).

  24. 13.
  25. Mohit Sharma
    December 8th, 2010 11:54 pm

    There is no provision to run the background task for long time. I have tried to use background task for long time and next time when app enter in forground… there is no way to end that task because no method was called which shows that app entered in forground…..

    Overall I do not think there is any method to run a background task(like sending location data to website) for long Interval of time..

  26. 14.
  27. Zbouch
    December 27th, 2010 7:49 am

    What a great article!!!! You answered my original question, held my interest, and gave me answers that made me delve deeper into the subject mater you presented. Very well done!

  28. 15.
  29. [...] Originally Posted by ChrisGonzales90 multitasking is good, but I don't like how you have to close each one. Why is there no "close all" option? Because you don't need it. iPhone OS 4 multitasking explained, again | When Will Apple? [...]

  30. 16.
  31. katieb
    January 4th, 2011 7:03 pm

    Thank you so much for this information that was not available anywhere else.

  32. 17.
  33. Jose
    January 28th, 2011 11:48 pm

    The only detail i see is thar when one has 30 apps opened on has to keep on clicking the close button. Otherwise multitasking on the ipad, phone, etc is awesome. I would love a “close all apps”button. I think that is one little missing thing, but it is still awesome.

  34. 18.
  35. Phred E
    July 26th, 2011 1:21 pm

    Justin, with regard to your reprimand of Kevin and his assertion that the fast-app-switcher-bar is indeed also a task manager, I suggest that YOU have missed the point.
    It may not appear to be a task manager, and Jobs/Forstall probably don’t want them to realise that that’s what it is, but it is. And it’s useful, in spite of Forstall’s ‘..you don’t have to’. Arrrgh! Some people just may have old habits, they may be tidy, or they may want to minimise the number of apps they have to scroll through to find the one they’re looking for. Any number of other reasons.
    “How can I dry myself off?” “You don’t have to; the sun’s out and there’s a nice wind..” Arrrrgh!
    Hokay?

  36. 19.
  37. [...] Originally Posted by Remeniz Gotta agree with ironass. I didn't know iphones weren't good at multi tasking and dual core cpu's won't make it much better at it. It's something that's controlled by the OS … See here:- How to Disable Multitasking on iOS4: ALL DEVICES | Iphone 4 Tips and Tricks iPhone OS 4 multitasking explained, again | When Will Apple? [...]

  38. 20.
  39. [...] two or three times a day. This link gives some good advice about leaving apps in the running: iPhone OS 4 multitasking explained, again | When Will Apple? Liked [...]

  40. 21.
  41. Lisa
    December 13th, 2011 1:28 am

    Funny, as I just got off the phone with the second technician from Rogers my service provider, who told me that my data is high because I have to close my apps. I have told them both times that that is untrue. Maybe I will direct them to this site! Lol

  42. 22.
  43. [...] tasking (the bar at the bottom of the screen that appears when you double click the home button). iPhone OS 4 multitasking explained, again | When Will Apple? It is very easy to delete a app from on the iPhone. You simple touch the app you are wanting to [...]

  44. 23.
  45. [...] Newsstand, iBooks and Siri features are included with the phone by default. The phone can “multitask“ and has a good battery life, in addition to its ability to store up to 64 GB memory entirely on the [...]

  46. 24.
  47. Flami
    September 20th, 2012 11:49 pm

    Sweet n simple explanation. Many thanks.

    -Flami Abs

  48. 25.
  49. how to get a free iphone free,
    April 8th, 2013 10:00 pm

    I have to thank you for the efforts you’ve put in writing this site. I am hoping to check out the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal site now ;)

  50. 26.
  51. free nfl jersey
    April 9th, 2013 12:58 am

    Aw, this was an incredibly nice post. Taking a few minutes and
    actual effort to generate a top notch article… but what
    can I say… I procrastinate a lot and don’t manage to get anything done.

  52. 27.
  53. the smtp2go review
    May 2nd, 2013 11:01 pm

    Tremendous things here. I am very glad to peer
    your article. Thanks a lot and I am having a look ahead to touch you.

    Will you kindly drop me a e-mail?

  54. 28.
  55. DAVID DICKINSON
    July 8th, 2013 7:29 am

    Thankyou my understanding of running apps is better now with your informative post,thanks again………….Dave.

  56. 29.
  57. todofamaes
    July 22nd, 2013 8:41 am

    Thanks for one’s marvelous posting! I truly enjoyed reading it, you will be a great author. I will be sure to bookmark your blog and may come back in the future. I want to encourage one to continue your great writing, have a nice afternoon!

  58. 30.
  59. plants vs. zombies
    November 7th, 2013 11:41 pm

    First of all I would like to say terrific blog! I had a quick question which I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear your head prior to writing.
    I’ve had trouble clearing my mind in getting my
    thoughts out there. I truly do enjoy writing but it just
    seems like the first 10 to 15 minutes are lost simply just
    trying to figure out how to begin. Any recommendations or tips?
    Thanks!

  60. 31.
  61. how to delete google plus accounts
    February 25th, 2014 3:14 am

    I every time spent my half an hour to read this webpage’s content all the time along with a cup of coffee.

  62. 32.
  63. how to connect to the internet
    March 5th, 2014 7:26 pm

    We’re a group of volunteers and opening a new scheme in our community.
    Your website provided us with valuable info to work on.
    You’ve done an impressive job and our whole community will be grateful to
    you.

  64. 33.
  65. Hans
    March 6th, 2014 6:24 pm

    Pretty portion of content. I simply stumbled upon your website and in accession capital to say that I get in fact loved account your blog posts.
    Any way I will be subscribing in your feeds and even I achievement
    you get admission to constantly quickly.

  66. 34.
  67. Lavon
    March 19th, 2014 6:44 pm

    Nice weblog right here! Additionally your site quite a bit up fast!
    What host are you the use of? Can I am getting your affiliate hyperlink in your
    host? I wish my website loaded up as fast as yours lol

  68. 35.
  69. Green Coffee Bean
    March 30th, 2014 3:47 am

    Amazing! Its truly remarkable post, I have got much clear idea regarding from this article.

  70. 36.
  71. green coffee bean extract
    April 8th, 2014 11:19 pm

    That is very fascinating, You’re an excessively skilled blogger.
    I have joined your rss feed and sit up for in the hunt for
    extra of your excellent post. Also, I’ve shared your website in my social networks

  72. 37.
  73. casino online
    April 10th, 2014 11:55 am

    Devo pagare una visita veloce di tutti i giorni un paio di siti
    web e siti web per leggere il contenuto , ma questo
    weblog offre funzionalità di base di scrittura .

Login »

OR