The Null Device

Multitasking on the iPhone

One of the problems with the iPhone is the lack of multitasking, or rather of non-system multitasking. Various officially blessed built-in applications (such as the phone call process, the built-in music player and the App Store downloader) can run in the background, but the system strictly enforces a ban on anything else from doing so. Which helps keep the iPhone (a small device with limited memory and battery life) from being bogged down under ill-behaved background processes, saves the user from having to contend with task managers and also reduces the risks of malware attacks, but at a cost; while an iPhone makes an eminently usable (mostly) single-task appliance, it falls down at tasks you'd want to run in the background. You can use it to listen to last.fm or SoundCloud or make Skype calls, but not whilst doing anything else. (And yes, I know you can jailbreak your iPhone and make it multitask to your heart's content, but that doesn't count.) Apple is a jealous god.

That wasn't as big a problem when the iPhone was the only phone of its class, but now, Android and WebOS have shown up, flaunting post-iPhone touch interfaces and being able to play your Spotify stream while you browse the web, and even hoary old dinosaurs like Nokia's Symbian are being brushed up and advertised as being able to multitask. Sure, a badly-written app there could drain your battery in no time, but that's beside the point; if multitasking works well enough (i.e., doesn't fail catastrophically often), Apple's system will look decidedly dated and overly conservative, and whatever Steve Jobs' aesthetic sensibilities say about it, Apple will have to put it in or risk becoming an also-ran. And, being subject to Steve Jobs' perfectionism, Apple's solution will have to not only bring in multitasking but do it without the compromises other systems have.

However, there is a rumour that the next version of the iPhone OS will do just that; i.e., will allow third-party developers to write processes that run in the background in some well-behaved way whilst managing to avoid the pitfalls of declaring a free-for-all.

I'm curious as to how they'll do it (assuming that the rumour is true, of course). My guess is that they'll focus on use cases such as processes needing to run a carefully constrained background thread, and communicate with it from the single-tasking UI process, and allow them to do this. Perhaps it'll use Apple's Blocks extension to C, and possibly a lightweight scheduling technology related to OSX's Grand Central Dispatch. That way, a background music player will be able to fetch and play audio until it is stopped or diverted by the UI (which can come and go).

There are no comments yet on "Multitasking on the iPhone"