iOS Multitasking for Dummies

In Uncategorized on July 10, 2011 at 11:45 am

I’ve had a couple of friends either new to the iOS or looking to buy a new smartphone ask me about multitasking on the iOS with concern. The two thoughts I heard were “are all these apps in the drawer really running?” and “multitasking, doesn’t that mean weird stuff can go on in the background that I can’t control?” It’s funny because multitasking on the iOS is designed to be as hands-off as possible for end users, quite different than desktop apps where we’re constantly aware of what’s running and what isn’t, and where we’re in direct control over the state of every app. Apple’s approach to multitasking on the iOS is meant to insulate consumers from task management and to keep naive developers from hogging resources while in the background like some of the iOS’s competitors.

Answering these two questions:

1. Are all these Apps in the drawer really running?

In short, no, they aren’t. The multitasking drawer is simply a queue of applications that you’ve had running recently, not of those that are presently running. In fact, every App you’ve ever opened will appear in this tray in the order of most recently used. One of the key differentiators between multitasking on the iOS and on Desktop OSes is that the iOS acts as a much stricter resource daemon. Usually only the first 4-10 apps in the drawer will actually be running, and the iOS is keenly aware of which Apps it should terminate and which it shouldn’t. Apps that are resource intensive or haven’t been used recently are automatically terminated by the OS.

2. Multitasking, doesn’t that mean weird stuff can go on in the background that I can’t control?

Not really. Multitasking on the iOS is incredibly restrictive from a developer’s point of view, but it’s for a good reason. Additionally, Apps are always a force-close away from being totally killed, although it shouldn’t ever have to come to this.

I thought I’d give a brief, simplified overview of how multitasking works on the iOS for those concerned parties.

iOS Multitasking for Dummies

There are essentially 4 ways in which an App can handle multitasking on the iOS.

1. Doesn’t run in background

Every version of the iOS prior to iOS 4.0 worked in this way, a couple seconds after you press the home button the App is terminated… easy. I miss these days. Developers can still make their Apps not multitask if they choose, some of mine don’t.

2. “Default”

Every App in the iOS gets this form of multitasking for free, and a majority of Apps don’t go further than this. Apps with the system’s default multitasking do remain existent in the background (unlike 1 above), but they are essentially frozen in carbonite 1-10 seconds after a user presses the home button. They spring to life very quickly when the App is relaunched, but they are not actively capable of doing anything in the background. Furthermore, if the OS is under pressure these Apps can be asked to unload resources in the background or even be terminated completely.

3. Background task execution

Background task execution is great for carrying out short tasks that will take a little bit longer than 1-10 seconds. What this does is grant an App a few minutes (exact number TBD by the OS at the time, about 10 minutes on the iPhone 4) to carry out some outstanding task in the background. The App is slowed down, it’s ability to use resources and the network is degraded, but it will still be capable of running. When the App’s timer is up it is forced into sleep (like 2 above), or it is killed completely if the developer doesn’t do their job right (like 1 above). Think of uploading pictures to Flickr: you launch the App, choose a dozen pics and press “upload”, then got to the homescreen. The App keeps merrily uploading pictures just like you’d expect, but isn’t allowed to run forever.

4. Special services

These Apps are the exception that are given free reign to run in the background, but they’re also not the types of Apps that you would want being terminated or frozen in the background. Think of streaming music, GPS, or VoIP. App developers must register their Apps as one of these services at the time of submission to the App Store, and Apple checks to verify the correctness of the requested permission. This way, a random App couldn’t register as being a fully-privileged GPS App while simply wanting to stay alive in the background.

So there you have, multitasking in the iOS. Don’t worry about it!

  1. This was very helpful. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: