How iOS multitasking really works

By Fraser Speirs, Macworld |  Software, Apple, Apple iOS

There's one bit of iOS misinformation that I keep hearing. Even supposedly authoritative sources such as Apple Geniuses don't seem to get it. It has to do with how multitasking works in iOS.

Here's the statement I keep hearing, and it's 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.

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 processor time (and hence battery), and the memory it was using is eventually recovered, if required.

The five faces of apps

iOS apps can exist in any of 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 relevant to 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. (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 might have to remove it manually in order to conserve memory. But you don't: iOS does it for you. If you launch a memory-intensive app such as a game, iOS will start to purge Suspended apps from memory 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.

Here's the confusing part: None of these states are reflected in the multitasking bar. That 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


Originally published on Macworld |  Click here to read the original story.
Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question