Wired.com Explains: How Mobile Multitasking Works

The major new feature of Apple’s latest mobile operating system, iOS 4, is multitasking. What took the company so long? Apple claims it was waiting to get multitasking just right before unleashing the feature for the iPhone. Meanwhile, the Android OS and Palm Web OS have supported multitasking just fine for over a year.

However, each platform handles multitasking quite differently. Let’s take a closer look at how each mobile OS’s multitasking works.

Apple iOS 4

How you use it
When you press the Home button twice, Apple’s iOS 4 displays a “drawer” allowing you to switch between apps. The drawer shows your most recently used apps. This is similar to the “alt-tab” functionality we’re accustomed to on traditional PCs.

What’s going on
When you leave an app in iOS 4, it’s not actually closing (unlike previous versions of the OS). Instead, it’s going into frozen, suspended animation, sitting inertly in the background. So when you relaunch an app, it opens instantly to pick up from where it left off before you “closed” it. That behavior allows you to switch between apps very quickly — a feature called Fast App Switching, which is the core functionality of Apple’s iOS multitasking. (TidBITS has an excellent in-depth explanation of Fast App Switching.)

Fast App Switching isn’t all iOS 4 multitasking does, as there are a few exceptions for specific types of apps. Apple allows apps that play audio, connect with voice-over-IP or use location detection to run quietly in the background while one thread is still active. So that’s why, for example, you can leave the Pandora app, and the music will still be playing in the background while you check your e-mail. Likewise, you can leave Skype while on a VoIP call, and you won’t hang up on your buddy while you’re browsing Safari, for example. Third, you can leave a mapping app or a fitness tracker like RunKepper and come back to it, and it’ll still have a lock on your location.

It’s up to third-party app developers, of course, to tell their apps to behave this way with the new iOS 4 software development kit.

Another sort of background activity iOS supports is push notifications, which keeps a specific internet port active while the iPhone is in hibernation, so you can receive e-mails, instant messages and alerts even when the screen is off. These alerts pop up on the screen in the same way as SMS on the iPhone.

WIRED Fast App Switching is indeed fast and stylish, avoids draining battery. All apps are constantly running inertly, so you can quickly switch between them all.

TIRED Only allows a single application thread to continue running; only certain kinds of activities are allowed to run in the background. Push notifications scream for your attention at the center of the screen.

Android OS

How you use it
Hold down the Home button and a tray appears showing the apps running in the background. Switch to another app and it instantly opens.

What’s going on
Android’s multitasking behavior is by far the most complicated to explain.

In Android, when a user switches to another application, the app you switched from doesn’t shut down: Its process is kept around in the background, allowing it to continue working (e.g., for downloading web pages in the background while doing something else), and come immediately to the foreground if the user returns to it. If the smartphone is running low on memory, Android starts killing off unnecessary processes to free up resources.

If a user later returns to an application that’s been killed, Android re-launches it in the same state as it was last seen, by keeping track of the parts of the application the user is aware of, and restarting them in the last state they were seen in. This last state is generated each time the user rotates the screen or leaves the application.

There are two basic components to control what apps can do in the background. Apps with “broadcast receivers” go into the background and wait to go off in an event, such as an alarm going off at a certain time, or if you receive a notification from Google’s server for getting a new message in Gmail. The other background component is called a “service,” which instructs an app to perform a task such as music playback or turn-by-turn navigation for a certain amount of time in the background. It’s up to the third-party app developers to embed these components in their apps so they behave these ways in the background.

WIRED Apps can stay fully functional while running in the background. Notification tray makes it easy for apps to give you information without interrupting what you’re doing. Users don’t have to manually quit apps when memory is running low: Android does that for you.

TIRED Getting multitasking to work just right in an app is a lot of work for developers.

HP WebOS

How you use it
The HP (formerly Palm) WebOS displays apps as “cards.” Each card acts similar to a tab in a desktop web browser. You move between activities using gestures (swipe forward, swipe back, hold to readjust the positioning of the cards), and when you’re finished with an activity, you can throw the card off the screen to quit the application.

What’s going on
WebOS allocates resources (memory, processor cycles, network access) to each card based on requests from the cards. The System Manager prioritizes the card in the foreground when allocating resources. Apps in the background are placed in a semi-dormant state, and their access to services is restricted.

If an application that the user isn’t currently interacting with wants to get the user’s attention, the app can display information in the notification area at the bottom of the screen. The information sits in the dashboard until acted on or closed. (Therefore, you can do something in a foreground app while dealing with a notification, whereas on the iPhone a push notification shows up in the center of the screen interrupting your task until you close it or leave your current app.)

Activities in the background do not have access to certain battery-intensive services. For example, apps cannot access accelerometer data and their frequency of network access is reduced. Third-party games are paused in place when moved to the background, reducing both their CPU load and memory consumption.

WIRED The card interface is neat, and it feels very natural to switch between apps. Notifications appear at bottom of the screen, not interrupting your current task.

TIRED After launching a specific number of apps that reach your memory limit, you can’t launch any more, and you have to manually quit an app before launching another.


No Responses to “Wired.com Explains: How Mobile Multitasking Works”

Post a Comment