At last, multitasking is coming to your iPhone*, iPod touch and iPad, allowing you to quickly switch between applications and use one while others keep doing other tasks in the background. This is how it works.
How Does It Work?
For the user, multitasking seems to work transparently and very quickly. According to Apple, you will be able to switch between applications instantly, while the application running on the foreground - taking over the screen - won't suffer slowdowns.
Using their method you will be able to answer an incoming SMS or chat with a friend or answer a call, and then go back to keep playing a game, just where you left it before switching to any of those tasks. Or you will be able to upload photos to Flickr but without having to keep the Flickr app open, like you have to do now. In this case, the Flickr application will keep uploading those photos while you go read your email or check the weather.
The user interface to manage all the running apps is quite simple: Double-clicking the home button will open a tray showing all running applications. Switching to another running app is as simple as clicking on it. It works like the task switch bar in Windows or Mac OS X.
Real Life Examples
Here's one example: In previous versions of the iPhone OS, if you are working on email and there's a link to a web page, clicking on that link will open Safari and close Mail. Then, once you were done watching that web page, you close Safari, get back to the main iPhone menu, click on the Mail icon, and go back to your mail.
With iPhone OS 4, Mail will keep running while Safari opens. To go back to Mail, the user just needs to double-click the home button: A dock will then slide in from the bottom of the page, showing the running apps. The Mail icon will be there, and clicking on it will instantly get back to where you left it.
Another good example is Skype: In previous versions, Skype needs to be open to receive calls. That makes it useless as a phone replacement. In iPhone OS 4, Skype can keep running in the background to receive calls. It doesn't matter you are surfing the web or playing a game: You will be able to pick up the call - switching instantly to Skype - have a conversation for as long as you want, and then return to your browser or game just where you left it.
While running on the background, apps can do a lot more than that. An application like Pandora, for example, will be able to keep playing music when you are not actively in it. The music playback will run in the background, just like the iPod component of your iPhone, iPod touch and iPad does.
Under the Hood
Apple claims their multitasking will save battery life and resources, unlike the competition. But how?
The reason is simple: This is not 100 per cent true multitasking. Not in the sense that developers define it: All system resources are available to all applications, with the system assuming the role of a traffic controller, giving preference to some tasks and less preference to others as needed.
Free-for-all multitasking will consume way too many resources, specially memory. This will make the system to choke, especially with the limited memory available in these devices. The CPU would also be taxed, and it will deplete the battery life quicker while slowing down applications running on the foreground.
Their method, however, is quite clever: Basically, it allows you to pause applications - like you can pause them in any UNIX-based operating system, while enabling some special services to allow some types of tasks - like receiving calls or playing music - to run on the background. There are seven kinds of services, and Apple says these will give the user the kind of multitasking they demand, but without choking the system:
• The first one is obvious: Background audio for apps like Pandora - and hopefully Spotify - is a must for consumers who demand other music sources beyond iTunes (it's good to see that Apple is taking this area into account specifically, just like they allowed services like Netflix in the iPad).
• Voice over IP services, for applications like Skype, are also logical, and another thing that consumers demand. Until now, VoIP applications were limited because they couldn't receive calls when they were not active. The developers can even use custom sounds for notifications.
• Background location works at two levels, allowing location applications to be aware of your whereabouts, even if you don't have the app open. Applications like TomTom would run this service in the background, so you can look at other apps while the GPS still tracks where you are. When it's time to take a turn in your planned route, TomTom will tell you using the background audio service. All without having to leave whatever software you are running in the foreground.
It works similarly with other non-GPS apps that need location services in a less active way than a driving app like TomTom. Those apps can use 3G cell towers triangulation to know exactly where you are, alerting you of friends proximity or things happening around you.
• Push notification was a background task already, but it has been expanded. The iPhone now also supports local notifications. These notifications are generated by the iPhone apps: If a cooking app has a timer, for example, it will be able to alert you when your roasted chicken is done.
• Task completion will allow applications to finish any tasks started before switching to another application. If you are sending or receiving a file in one app, you would be able to switch to another app, and that file will keep downloading.
• Fast app switching will make all running apps instantly available. Rather than having to start them up each time, like now, the apps in iPhone OS 4.0 will be able to sleep, ready to be awaken at the click of an icon in the running apps tray.
Basically, what Apple has done is to solve all the complain from users who wanted to do several things at the same time. While this is not 100 per cent multitasking, in the traditional desktop sense, it's a good thing. Consumers won't care about full multitasking if it really works like this. It's all a matter of perception and being able to do what you want to do, as fast as possible, while keeping the sense of speed and a long battery life.
With that in mind, this approach seems exactly what the iPhone, the iPod touch and the iPad needs.
* Multitask won't work with the original iPhone, iPhone 3G, or the first and second generation of the iPod touch, because they only have 128MB of RAM.