There's been a lot of discussion lately about the iPhone OS's lack of multitasking. That is, the iPhone OS can only let one app run at a time, and this is a frustration for many people, myself included.
The introduction of the iPad has led to an increase in this chatter, largely because the assumption is that this device, too, will be limited to (essentially) running only one app at a time.
The iPhone DOES Multitask
To be clear, the iPhone OS supports multitasking just fine. It shares its core with Mac OS X and obviously that runs multiple apps without any concern. The iPhone OS is no different, and many apps DO run in the background including Phone, Mail, Safari and a few others. The problem is these are all Apple's apps, and no third-party apps have been granted permission to do this.
Multitasking Leads to MultiCrashing
I get why Apple is hesitant to allow third party apps to run all the time. Prior to being an iPhone owner, I used a Palm Treo 650 for over two years. It took me (a self-professed geek) close to three months to get that thing to run without crashing multiple times per day (yes, day). The reason for every one of those crashes were third party apps running in the background. I wanted the functionality those apps provided, so I had to run them, and it took me those three months to find the perfect mix before getting it right (and then I didn't change a thing!).
Even though Apple approves every app you can use on your iPhone (another rant for another time), there's still the possibility of one or more of these apps causing some negative condition. That could be a complete crash or it could simply be that the app is so hungry for processor RAM that it causes excessive battery drain or a system slowdown. You, as the user, likely wouldn't know what was causing this, and you'd simply complain that the iPhone is slow or its battery life is even worse than it really is. That's bad for Apple, and these are likely some of the reasons they don't allow more than one third-party app to run at a time.
We Don't Need No Multitasking
The thing is, I'm not sure we really need apps running in the background. Let's think about this: how many apps do you have open right now on your Mac? Of those, how many are actively doing something you care about vs. those that are simply open, waiting at the ready for you to bring them to the front and use? My guess is that for most average users, the only app you care to have running is the one in the front. The rest could very well be frozen in stasis until you bring them to the front to resume your work, right? In fact, that might even be better since that way all of your computer's resources could be devoted to making the frontmost app work the best.
The same is true of the way most of us use the iPhone. We don't need apps to multitask, we simply need apps to sit dormant in the background waiting for us to bring them to the front. This way we don't "lose our place" in the app when we want to go check mail or look something up on the web before returning, and the app doesn't run away with anything in the background.
What About Messaging?
As for all those Twitter, instant-message, or third-party email apps (we just need 'em!) where you may actually want it to poll and process in the background, there are two workarounds here. The first is something Apple has already implemented: push notifications. These are functional, but require a server-side commitment from the developer. I'll be the first to agree that this isn't perfect, but it works. The second is something also already implemented by Apple: To be efficient, Apple's iPhone Mail app can be set to check mail in the background at pre-set intervals, otherwise it, too, basically sits in stasis. Why not let this "polling interval" be usable by many apps. The iPhone OS is event driven, so simply create a new event that says, "hey, wake up and do your thing, but do it quickly or I'll shut you down." Then, every 15, 30, or 60 minutes the iPhone OS tells each app to do its thing and then freezes the app back into stasis when it's done (or when time expires, perhaps after 30 seconds). The apps just have to do their polling, all the screen updates and the rest can simply wait until the next time the app is brought to the forefront.
Don't Forget Memory
Yes, this still leaves the issue of the limited RAM available on the iPhone. Each app in memory (be it active or in stasis) still takes up memory. For this, I think the answer is to invoke some sort of virtual memory system on the iPhone. In a simple example, Apple could allow the operating system to save applications and their memory space off to the Flash storage when in stasis, only to bring it back when requested. Perhaps it would be possible for an app to leave just a bit of code in RAM and the rest in Flash, for those apps that need to use the polling interval model above.
There could even be a fixed limit that keeps a maximum of, say, 5 apps in stasis at any one point in time. I think that's more than enough, and allows us most of what we'd need from "multitasking" while still avoiding the potential pitfalls therein.
We Need Something
Somewhere, somehow, this issue needs to be solved. Especially with the iPad, but even with the iPhone, there are many instances where we want to leave an app in a certain state while we bounce out to check mail, look something up on the web, write in the notepad, or some other quick task before we return to our work. Let's hope Apple figures this out soon, for our sake and theirs.