Complicated. Like relationships
Multitasking is, essentially as it says on the tin. Multiple tasks. Simultaneously. But with the iPhone OS 4 release, and WP7’s model with regarding, well, not multitasking…multitasking, hybrid multitasking (WTF?), it seems a bit complex as to what multitasking is, and what it’s become. So let’s take it from the top. With MT being thrown around as one of the important things for devices like Windows Phones and the iPhone, it’s probably important to bash out why it’s kind of not-really-an-issue-at-all.
First up of course, is classical, thread based multithreading. This takes a ‘task’ (aka process, or ‘app’ or ‘program’ it will be process from herein, later explained) and splits it into even more fundamental components; threads. These are essentially the fundamental units that execute, and a program, properly written will probably, depending what it is and how it does it, have multiple threads. Ignoring stuff like hyperthreading, crazy IBM chips that can run multiple threads simultaneously per core, and of course, multiple-core processors and multiprocessor systems, a processor is only capable of executing a single thread at any one given time. The illusion of multithreading is very transparently handled by switching between these threads extremely rapidly, so that in the space of a second, hundreds of thousands of threads have all executed a bit, and that apparently, progress has been made on lots of threads at the same time. You then get a complex thread lifecycle, which I’ll diagram but not detail too much, that looks a bit like this;
What you have is a system that’s capable of switching between threads and running multiple threads in sequence very quickly. It allows for threads to yield when they can’t do anything (waiting on data, disk reads etc), and generally, it’s pretty solid. What’s more, it’s absolutely vital for doing more than one thing; a single serial process that serviced everything in turn would be a nightmare. With this is mind, it’s important to note, that at the operating system, nearly everything implements this in an extremely similar or identical manner. This includes your desktop computer, your laptop, your BlackBerry, your Windows Phone, your iPhone, your featurephone, your crappy £20 pay-as-you-go dumbphone, your Sky box and so on. At the OS level, this is implemented by everything. iPhones multitask, Windows Phones multitask, they have to.
But iPhones (iPhone OS 3) can’t multitask, and Windows Phone 7 devices can’t multitask. And Android devices can, and your laptop can, and Windows Phone 6.5 devices can, and this is where it starts to get a bit more complex as to what multitasking actually means. As already covered, all these platforms can, they have to. It’s more about how the operating system treats non-system threads and API stuff. On the iPhone, the first-party apps have the benefit of being essentially system threads; you can open iPod, play music, carry on what you’re doing. It multithreads in the background as an allowed system thread. Do the same with, Pandora (as seems to be the popular use-case, I’ve actually never used it!), and you close the app and…the music stops. Equally, if you bust out a task manager on the iPhone or on the Windows Phone 7 emulator, you can see a whole bunch of tasks running, such as services, communications, updating stuff, Exchange clients, etc.
This actually has nothing to do with technical implementation of multitasking, as the OS is perfectly capable, it’s about what restrictions are placed on third-party apps. However, unlike desktop processors, you want to keep processing to a minimum to save on power, and the truth is, even the Apple A4 in the iPad, and Qualcomm’s Snapdragon line on 1GHz+ processors just aren’t that powerful to have tons of threads running.
What iPhone OS 4 and Windows Phone 7 do is have this smart multitasking. Essentially, when you hit the Windows button on a WP7 device, it bumps you out to the start menu. Your app’s ‘state’ is saved to memory, and it’s threads essentially killed off. You do what you do, and go back to the app. It’s threads are started up, and its state reloaded from memory. Microsoft call this ‘dehydrating’ and ‘rehydrating’ the app, and it’s a pretty good analogy. It’s still there, but it’s been freeze-dried and doing nothing. But, just add water, and it’s right back, where it was. The approach taken in iPhone OS 4 is nearly identical. And the thing is, it’s pretty damn clever. Multitasking of the desktop type just isn’t suitable for low-power devices like phones.
The only downsides are for certain types of apps; persistent network based communications clients, music programs and so on; which HAVE to be running to work. You can’t play music from a dehydrated thread, you can’t have Windows Live Messenger running in the background but not actually running. So the solution is exceptions for these few cases. Apple are allowing exceptions of the following; audio streaming, VoIP, GPS, and completing important tasks (such as completing upload of photos to Flickr). Windows Phone 7 takes a similar approach; apps like Last.fm and Pandora run through the Music hub, Flickr runs through the Pictures hub, communications like Windows Live Messenger are handled at OS level, and GPS is managed at the OS level, so it’s kept warm and spun up so it doesn’t have to re-lock when you switch back to your navigation app. Equally, locally and network generated notifications allow dehydrated apps to react to external activity, such as receiving an IM, an alarm going off, reaching a location. When these notifications cook off, you can then bounce to the app, and it’s as if it was…running. Smart-multitasking with these platform exceptions allow WP7 and iPhone OS 4 to satisfy the massive majority of multitasking critical situations without actually…multitasking.
It sounds like trickery, it sounds like you’re being cheated, and as Android and Pre users would probably have you believe, it’s not ‘true’ multitasking. Well, no, it’s not. But ‘true’ multitasking would be kind of stupid, now that you know what is, how it works, and what smart-multitasking is. Phones aren’t desktop computers, they don’t look like them, you don’t interact with them in the same way, and they shouldn’t have the same end metaphor of how stuff works as them. Because phones are not desktops.
What it really boils down to at the end of the day is this; users want to be able to bounce between apps, play music in the background, be available to talk to on IM programs. And what matters is that you can do this. How you do it isn’t so important; but doing it right is important. This ‘true’ multitasking crap is getting thrown around, with ‘Windows Phone 7 can’t multitask’, and ‘iPhone OS 4 can multitask’, or ‘Android multitasks’, but it’s just that; crap.


















A+++++ post, would read again.