Why the iPad and the iPhone don't support multitasking
blog.rlove.org
blog.rlove.org
He loses me here. My iPhone has a 32GB SSD hard drive. Sounds like a perfect medium for swap space to me...
The techie in me was aghast at the idea of Apple shipping iPhones with a full Unixy kernel but with no swap (and minimal background processing -- and for that matter, I wondered why its Objective-C runtime didn't support garbage collection) until I actually laid hands on one and realized how fluid things can be when they don't stutter and stop randomly while swapping in parts of the foreground program.
Such jerkiness gives a feel of "computeriness" to the user when running desktop OSes, breaking the feeling of fluid interactivity that one gets with a "real-world" object. It also causes a lot of user anxiety and even errors: it becomes a normal part of the experience to click on an item and then have a second or two of wondering whether the app "heard" you or not. Often followed by more clicks, which end up being misinterpreted when the app finally gets to run again, and now the user's mental model is completely out of sync with the system's state.
In the physical world, you never flick a real switch on a panel and then it actually moves a second or two later!
I know some old lights which do that.
It was in the 80's that PCs couldn't even scroll a line of text without making odd stops at times, it was in the 90's when I was surprised to still keep seeing the phenomenon, and it's these days that I can still see a modern Windows screensaver stutter for no reason. Or just some mouse click taking a few seconds "to deliver".
The reason I (and so many other people) so adored the Amiga still late in the 90's is that anything like that was completely unheard of. The computer was just so snappy. Everything happened pretty much immediately. I remember that around 1995 or so there was a web page that had 256 GIF animations playing on it simultaneously. My bare Amiga could run them all smoothly despite me even doing something else in another window. My friend's Pentium pretty much choked on the very same page.
Linux desktop is nothing compared to Amiga. BeOS was close but died as well. I want a completely 100% responsive, stutter-free multitasking desktop/ipad/phone because I know it's possible. I don't want to settle for too slow latency or live with the false claim that to be snappy you can only run one application at a time.
http://serverfault.com/questions/23720/should-you-disable-pa...
If it's correct that at least Palm's webOS and Maemo dare to swap on flash storages, we shall see soon...
No swap file + no virtual memory + lots of stuff pre-cached onto RAM disk = snappiest user experience ever.
But, ah...
lea bbye,a0
move.l (a0),$80
trap #0
rts
(to take it back on-topic)(they can cut corners in data storage requirements right now because the drives are written-to/read-from much less often than on a PC, so both longevity and speed are much smaller concerns)
Embedded engineer here: Solid State Drives do lots of things GREAT. However "being a drive which swap is used on" is not one of them. That's because swap memory is written very often compared to any other portion of the drive. This quickly wears out the drive in that location (and all flash has a limited number of writes, and SSD is a flash technology).
There are specific drivers for doing swap on flash devices. But it isn't easy to do well without compromising usable life of the device.
IF you're interested in doing virtual memory in an app: http://www.alexcurylo.com/blog/2009/05/14/tip-iphone-virtual... is a way to do it, there is a hacked iphone app that also enables it too (don't have a URL offhand).
I dis-recommend doing so.
Actually this argument is a straw man. Apple can't make background processes run for free contrary to the laws of thermodynamics. However they can limit the resources they can use through the right API. (Register functions with realtime constraints, and request a "level of service.")
I care about multitasking for things which actually need to do stuff in the background, like Pandora or IM clients.
Just as he says, Skype keeps getting killed when it's in the background so I can't depend on it for getting calls.
http://technologyexpert.blogspot.com/2010/03/wozniak-carries...
I've really only seen a couple compelling use cases and that is Pandora (basically music running in the background for the uninitiated) and the YC Wakemate app. Anyone have any others that couldn't be solved with push?
On the Pre, which has the best multi-tasking implementation I've seen, these sorts of tasks are a no-brainer. You know that your previous applications is just a couple of swipes away, so you're never afraid to leave it.
Constantly shutting down and restarting applications may be good for performance and battery life, but the user experience is hampered.
It's surprising how few people realize that the built-in apps (Mail, iPod, SMS etc) run perfectly in the background. The lack of multitasking is limited to 3rd party apps, which helps explain why most iPhone users never complain too much about the lack of real multitasking.
Trying to predict what the users will and won't ever need to switch to and from and back to again is a crap shoot in general. Sure one can get it right much of the time, but why not just suck it up and make the overall solution better so there aren't those cases where one guesses wrong.
From the outside, this feels like a bizarre, "accept no criticisms of an Apple product as valid" kind of thing. Stuff like Browser Duo and mini apps make it clear that the longer Apple doesn't solve this in general, the more other developers will put together "do x and y at the same time" applications. Does it really seem better to have these kludges than a general solution?
But doesn't that wrapping rely on something else's developers realizing that the user might want to go off to the browser and back? What if it wasn't Safari in the middle but any one (or three) of the numerous other programs the user might want to take a side trip through. It gets back to the crap shoot of trying to guess every multi-application use case that will be wanted. All this to defend not putting together the general solution which is entirely doable to begin with.
Android actually has a pretty damn clever model where normally Activities are killed whenever they're not visible (similar to the iPhone model). However, and application can register service processes that run in the background to do things like play music, check for updates (email, IM, etc).
The difference between the Android and the iPhone model is actually pretty small. The main difference is that on the iPhone, only certain Apple provided apps can do things like play music in the background, get background notifications, etc. In Android, third party applications can also be written to do those things.
But in the most common case of apps that don't do things in the background, the application lifecycle of iPhone apps and Android apps is actually quite similar.
And I'm pretty sure that if I include another two apps (safari and mail) on my exception list most people would be okay without multitasking.
I don't need a window manager, I need to focus on the app I'm using and the ability to reply (or send) sms and mails and check something on the web without quitting the current app.
I get Apples position. The iPhone is the spiritual successor to the PalmOS. It looks, feels, and works very similarly to it. Even early finger-based applications first made their appearance on the Palm (here's looking at you SnapperMail with your fat finger mode). The Palm had thousands of apps and solved a ton of problems without multi-tasking. So I get it... you can build a really useful device without it.
Yet there is so much more you can do with a well thought-out system like Android has. As Android gets more traction (and thus more developer interest) I think your going to see more and more separation between the quality of the apps available on the devices. There are simply going to be killer applications that force Apples hand to stay competitive.
Very few apps need completely open ended multitasking. Most apps need very specific capabilities. An API for registering time limited functions with timing, location, and other services would take care of 90% of the needs out there.
It fully supports it. This is a control situation, where Apple has decided "We want our devices to have good battery life more than we want to allow multitasking".
Do you see your mail being checked while doing other things?
Do you get background notifications while doing other things?
Do you get appstore apps downloaded while doing other things?
The iphone is fundamentally built on a mach kernel, which supports multitasking. Taking it out, when they already needed to use it for multitasking for the above tasks, is a silly idea.
Here is a rundown of other parts of the iPhoneOS kernel: http://www.roughlydrafted.com/2007/07/13/iphone-os-x-archite...
Every other mobile OS supports multitasking and all the smartphones i know have similar battery life. Symbian, Windows, Android, all have multitasking and yet people try to convince me that it, "not needed", "not possible", "makes the device unstable", "drains battery too much" which is just not true. My Android phone lasts at least as long as an iphone and i use multitasking all the day. It's just that the OS was truly made for this and it does it quite well.
However, you can have an open but idle connection open in the background with only minimal battery drain. That's how pretty much every kind of push notification or IM system works, even on cell phones.
The best way to save battery on an Android phone is to turn off WiFi unless you need it at some point during the day. iPhone will stop attempting to do push notifications and the background Apple apps will disconnect if the only available connection is WiFi.
I'd also like to point out that "I bet the app was poorly written" is exactly the situation Apple is currently avoiding until they are confident they have a reasonable technical solution to it.
Playing streaming video will kill the battery pretty decently, but IMHO that seems fair. Your keeping the radio pretty busy, the audio hardware, the cpu, etc.
I'd actually like to hear from an iPhone user whether they can run Pandora or Last.fm for 5 hours straight without killing their battery either.
Read this: http://geekfor.me/faq/you-shouldnt-be-using-a-task-killer-wi...
It would be too much work to vet every app for good concurrent programming. It's a much better idea to disallow it and add an API with resource controls later. This is the only way to protect users from resource hog apps.
I'm not sure how Pocket Tunes Radio is able to play in the background, but they've found some Apple-sanctioned solution that works for MP3 and AAC+ streams. Or I can use Safari to start an MP3 stream and it will background just fine.
I'm sure Apple could just make a policy decision to let some apps they approve run in the background.