One of the big features of Android commonly touted as being a key difference between it and the iPhone is “multitasking.” Android users commonly say how obviously necessary this is in any modern computing device, while iPhone users don’t see the need or claim they don’t want it either because of a perceived performance hit or potential battery drain.

First off, we have to clarify the concept of multitasking. On a desktop, notebook, netbook, etc., you will frequently have multiple programs open at a time and often more than one is visible on the screen. In most cases, these programs are actively running (usually with priority given to the application in focus) and using some processing cycles. Sometimes the background applications do need to use resources, such as an instant messaging client or music player. Sometimes they don’t, such as when you are actively playing a game but left a browser window open in the background.

The misconception is that Android handles all these processes the same way, forcing them to fight it out in a cage match with the winner getting processor cycles. Fortunately, that is not the case.

##Unnecessary Processing##

Most of the time the limited screen real estate means you don’t need background processes running for applications that don’t currently show any UI. Essentially, the processing associated with an activity ends, but the activity remains in memory until that memory is either needed or the activity is back in focus (obviously this is a bit of a simplification). When an activity goes into the background like this, it typically does any saving necessary. That allows the memory to be recovered aggressively, if needed, without creating delay at the time of recovery.

Some iPhone apps actually have similar behavior, but they store their state to the phone’s storage rather than the memory. This allows you to reopen an app, starting from the same point you ended it. Clearly, both Apple and iPhone developers see this ability to quickly switch tasks as valuable, despite that it isn’t “built in” to iPhone OS.

##Necessary Processing##

The other key situation is something called a service, and this is where the differences between Android and iPhone OS are most noticeable. A service is a process that does not directly have UI or an activity associated with it. A process for handling the reception of instant messages is a good example. You don’t want to sit on a screen all day to wait for new messages. You want to be able to check your email, browse the web, or play a game. The service can run in the background and unobtrusively notify you of new messages.

##Apple’s Situation##

Apple sees the need for some apps to have background processes; the music player is a good example. Apple just hasn’t fully opened the door to letting the third-party developers run background processes. Instead, they allow for push notifications.

But push notifications are not the complete answer. They have an extremely limited 256-byte maximum payload. They are not secure. They require extra infrastructure. They overwrite each other. They are designed for text only. The application cannot manipulate the push notification data if it is not running. And, worst of all, push notifications are extremely intrusive! Implemented properly, push notifications could be the correct solution for some situations, but they currently present a bad user experience and have limited value to developers.

##Additional Uses##

Besides music players, instant messengers, and SSH connections, location-based services like Google Latitude are virtually useless without background processes. Another example of a background service is common in feed readers such as NewsRob. While you don’t have the app open in the foreground, it is still able to periodically fetch new feed items. That means you can later open that app without an internet connection and still read your favorite feeds. With iPhone, you have to actively open each app and tell it to cache the data for offline reading, wait, and then repeat for each app you might want to use (such as during a plane ride).

##Even if you disagree##

Finally, even if you believe nothing of what I have written and still believe that background processes waste a huge amount of processor cycles and drain your battery, then you should ask yourself how the Nexus One has a battery life comparable to the iPhone’s when it has a faster processor that is pushing more than twice as many pixels, it has more RAM, it runs third-party background applications… not to mention the battery is user-replaceable ($25 for an Android battery; roughly four times that for Apple to replace an iPhone battery). It must be from HTC stealing Apple’s innovation again *sigh*.