Thursday, April 21, 2011

Multitasking Differences: WP7, Android, and iOS


Share


Everybody wants a smartphone that multitasks, but multitasking can have different meanings and certainly different methods and implementations. We've recently learned that Windows Phone 7's Mango update will enable multitasking for the new OS, but it's definitely not going to be the same as the way Windows Mobile did it back around the turn of the century between 2000 and 2010. Back then multitasking was implemented in a similar way to how desktop computers do it. If you launch an application, it stays in memory. If it's performing a task, it will use the CPU as much as it wants until it's done regardless of whether you want to access another program and don't have the resources to do it.

The innovative part of Windows Mobile's multitasking implementation was supposed to make things easier on the user by managing open applications and resources itself. If a program wasn't used for a while and the system needed more memory for other applications, it would close the unused programs and release their resources for use by other programs. Unfortunately sometimes the act of releasing those resources for other applications required more resources than were currently available, thus making the device lag for anywhere between a second or so, to indefinitely frozen.

Android began development in 2003 before being bought by Google in 2005 and Multitasking the Android Way is similar in many ways to the way Windows Mobile originally did it. The Android way is a little more complicated in that instead of simply shutting down whatever process was least-recently used in order to automatically free up resources, Android uses a set of rules to decide how important each process is and thus the next one that should be dropped. Android also supports special background receivers and services that may be designed to run at all times. If Android never runs out of memory, all applications that a user runs will continue to run indefinitely.

Then there's Apple's iOS implementation of multitasking. Originally, there was no multitasking in Apple's iOS. This made for great performance since the entire mobile device's processor and RAM were fully available to the foreground application. Of course, that made things like running background applications at the same time as other things more difficult. Thus, with iOS 4, Apple implemented a
new type of multitasking. Apps that require specialized functionality can register with the system in order to maintain one thread's functionality at all times (or until it is stopped). These threads are limited to functionality related to playing/recording audio, location detection, and voice-over IP. In all other cases, when you press the home button, iOS 4 apps go into a suspend mode where the app becomes inert until you come back to it. In suspend mode, apps don't use the processor, but they do take up memory. iOS will terminate the oldest suspended apps when it needs more memory.

Windows Phone 7 originally took the same path as the early versions of Apple's iOS with no multitasking for 3rd party apps. Shortly after you navigate away from a 3rd party application it is shut down in order to reclaim any resources that it was using when in the foreground. Of course, certain native applications have full multitasking capabilities on Windows Phone 7 just like earlier versions of iOS did. The advantages to this method are more consistent battery life and better performance for the foreground application. With Windows Phone 7's Mango update to be released this year, that will all change. Windows Phone 7's implementation of multitasking will be kind of like a cross between what Apple's iOS4 does and what Android does.

With Mango, if developers want their apps to be able to do things in the background, they can create "Background Agents." The difference between this and just any process having free reign over the system even when it's not in focus is the fact that background agents will be restricted to only using 10% of the CPU and 5MB of RAM while on battery power. Some apps will only be allowed to run for 15 seconds every half hour for things like syncing data. One interesting feature is that background agents will have less limitations when the device is plugged into a charger. In other words, it sounds like when the device is on AC power, developers will be able to take advantage of more power and longer data download times. Presumably this would be similar to the Zune WiFi sync where after a few minutes of being plugged into the charger, a Windows Phone 7 can automatically start syncing videos, music, and pictures from your desktop.

The reason for such different methods of implementing multitasking is to find kind of a balance between maintaining system performance and consistent battery life while also enabling functionality for the user when not explicitly interacting with the device interface. On one end you have the types that really need a lot of help from the user in order to keep things running smoothly, while on the other end we have more limiting methods that are easier on the user, but more of a pain for the developer. Which blend of compromises do you think will work the best going forward as devices gain processing power and memory capacity?

Source: pocketnow.com

No comments:

Post a Comment