It’s time to relax about multitasking

There was one thing I had intended to rant about last week that I just didn’t get to. People need to chill the heck out about multitasking on the iPhone. I see comments every day either decrying Apple’s implementation as not “real” multitasking, or helpless users asking how to make sure background tasks don’t grind them to a halt and kill their battery. Both of which tell me that there’s still a HUGE misunderstanding out there about how multitasking in iOS 4 actually works.

Let’s start with how it works on the desktop, which is what most people consider “real” multitasking. This is more formally known as “preemptive” multitasking, in that the operating system can preempt processes in favor of others to ensure that everything runs smoothly. Prior to the advent of multicore processors, the CPU could still only do one thing at a time, so the operating system had to decide which process got how many clock cycles. From the application perspective, they just ran without any consideration for other applications, and could continue asking for as much CPU power as they could get even if they were not the foreground application.

As anyone who’s tried to rip a DVD or transcode a bunch of media can tell you, even with a relatively smart preemptive multitasking operating system like modern day Windows, Linux or OS/X, background tasks can still use so much horsepower that they slow your “active” task to a crawl. On a laptop this is bad enough, but on a handheld, this can be the difference between having a smartphone and having a… rock. So clearly, a more sophisticated method was needed.

Or was it? The preemptive multitasking described above is essentially exactly how multitasking works on webOS. It is very similar to how multitasking works on Android (which is a little better at managing the resources of background tasks, but not much). And people with webOS and Android devices—and yes, Windows Compact Embedded, formerly known as Windows Mobile 6—learn very quickly how to manage their running programs and kill tasks that they don’t need running in the background. Very quickly, you get acclimated to micromanaging your phone, clearing memory and closing tasks and doing all sorts of digital housekeeping that has nothing whatsoever to do with what your phone is supposed to be actually doing.

Apple wanted none of this. And for the first three iterations of the iPhone, they simply didn’t provide multitasking for third party applications. They supported true preemptive multitasking for their own apps—iOS is built on the same core as OS/X, so it’s always been capable of it—but drew the line at apps that they could control. For everyone else, it was one thing at a time.

Which honestly, didn’t work so bad. Something I’ve noticed now that I have multitasking on my iPhone is that my attention span is just as fragmented as it is on my desktop. Not being able to flit back and forth between apps without losing your place did enforce a certain amount of focus. But anyway…

With iOS 4, Apple introduced their model of mobile multitasking. They didn’t invent multitasking, and no one is saying they did. But they did come up with a way to implement multitasking that seems to avoid the problems that desktop-grade multitasking has on mobile devices. The problem is that it’s also a little more nuanced, a little more complex, and a lot of people still haven’t figured out what it’s actually doing.

In iOS 4 when you double tap the Home button, the screen slides up and you see a row of application icons. THESE APPS ARE NOT ALL RUNNING AT THE SAME TIME. Depending on the app, they could be doing one of three things.

For apps that haven’t been updated to take advantage of iOS 4, the icons in the task switching area are exactly the same as the ones on the home screen. The app isn’t running, then when you tap the icon, it starts up from zero. When you switch away from the app, it goes away, removed from memory entirely until you call for it again. Needless to say, these apps use absolutely no CPU or RAM when not in use, even when you see them in the task switching area.

Apps that have been updated to support iOS 4’s fast app switching—but nothing else—behave a little differently. (To support fast app switching, all developers have to do is recompile their app with the iOS 4 SDK. They don’t have to add a single line of code. So eventually, all but completely abandoned apps will support this.) When you switch away from these apps, their process is suspended—using absolutely zero CPU—but they remain in memory. This is the key reason even this most basic multitasking feature isn’t supported on the iPhone 3G with its anemic 128MB of RAM. On a 3GS with 256MB or an iPhone 4 with 512MB, lots of applications can hang out, suspended, without impacting the speed or battery life of the device in any way. When you run the program again, either from the task switching area or the home screen, the process is simply unsuspended and resumes exactly where it left off. On occasion, you will run so many apps that you start to run out of free memory, in which case iOS will save a snapshot of the process to storage and kill the process. It will take a little longer to resume the next time you run it because that process snapshot has to be loaded into memory from “disk”, but it’s still faster than starting the program from scratch.

There are six other discrete functions apps can call to do things in the background. Sound can play in the background, VOIP apps can listen for an incoming call, GPS apps can keep tabs on your position, apps can continue a specific time-consuming task like uploading a file, etc. In these cases, part of the program does continue to run while this task is carried out, but there are two important things to remember. When the app is done doing the thing it has a good reason to be doing in the background, it suspends, just like apps that only support fast app switching, and the part of the app that remains running in the background is far smaller than the full application.

For example, when I’m listening to Pandora, I can switch away from it and let it play in the background. When I’m doing this, the part of the app that streams the music is all that keeps running. The rest of the app, the part with the user interface and menus and whatnot, is suspended. It no longer takes up any CPU of its own. When I put a GPS app in the background, it keeps track of my position and can even continue to give me voice directions, but the part of the app with the map no longer updates.

What does all this mean? It means that you don’t have to micromanage your device to prevent multitasking from killing your phone in iOS 4. Yes, you can manually “kill” an app, terminating the suspended process and removing it from RAM by tapping and holding on the icon in the switching area and then tapping the red minus sign, but you should almost never, ever have to. I’ve done this once, to force a Twitter app to pull tweets in the “gap” between updates. For just about everything else, you can just trust the device to kill off processes itself when it needs the RAM. You don’t have to do it yourself. (And yes, every once in a while I’ll notice an app “hitch” for a second when I’m loading it, telling me that something else just got purged from memory. It’s only noticeable because I’m looking for it, and doesn’t impede my use of the device in any way.)

It also means that the people complaining that the iPhone doesn’t support “real” multitasking need to take a deep breath and get over it. Apple’s implementation of multitasking is a compromise, yes, but it’s a very elegant, effective compromise that provides the benefits of full desktop-grade multitasking at a fraction of the resource cost. Smartphones are much more powerful now than they were just a few years ago, but until we have orders of magnitude faster processors and bigger batteries, Apple’s version of multitasking makes more sense than allowing any app to do whatever they want.

iPhone 4: The bars are a lie

There has been, well, some vigorous discussion this past week about the iPhone 4 and what those bastards at Apple have foisted upon us. People are losing their freaking minds. Lawsuits have been filed. People are threatening to take their phones back. And, of course, people have emailed Steve Jobs directly, with results of varying veracity.

Only, the thing is, it’s really not such a big deal. I know people are angry, and they have every right in the world to feel that way. And I know Apple has been unusually tone-deaf in how they’ve handled this situation, but I also think they’re doing the right thing. So let’s take a step back, look at the situation for what it really is and see how this all sorts out. (This would be a good place to take your happy pills if you need them.)


The single most striking feature of the iPhone design, which you notice even before you see the ZOMG droolworthy screen, is the stainless steel band sandwiched between the two plates of glass. This is not only the structural support for the phone, but also the antenna. The left side, from the headphone jack around past the volume buttons, is the WiFi/Bluetooth antenna, and the rest is the cellular antenna. While this design choice simplifies and minimizes the layout of the phone, it also means that you will, in the act of holding the phone, alter the the reception of the phone as you, who are essentially a bag of salt water as far as RF signals are concerned, change the conductivity of the antenna.

The result is what has become known as the "iPhone Death Grip." If you hold the phone so that your skin bridges the tiny gap between the WiFi and cellular antennas, you can watch in awe and/or horror as your signal bars drop from five to one. This "design flaw" is what all this fuss is about.

Signal attenuation, by the numbers

Sure seems like a design flaw, right? To go from full signal down to nothing just by touching the phone? Touching the phone in the exact same way you see Steve Jobs holding it in just about every picture of him and the iPhone 4 on the web?

Well, maybe, maybe not.

See, the truth is that five bars can be well removed from "full signal," and even that’s kind of a misnomer left over from analog phones that doesn’t mean much in a digital world. Let’s look at the actual math for a minute. This won’t hurt a bit.

Click to read more the by creator of this chartRF signals are measured in negative decibels. The best signal you can get, standing right next to the tower, is -51 dBm. The worst is -113, the point at which AT&T’s towers just stop trying to talk to you. Now, you would think that the bars would be evenly distributed over that 65 dBm range. But the problem is that it’s a logarithmic scale. -100 dBm is ten times weaker than -90 dBm.

As a result, you see a "full" five bars all the way down to -90 dBM. Meaning as soon as you start losing bars at all, you’re not approaching the cliff, you’re already falling off.

This is already confusing, but it gets worse. When you touch the antenna, depending on conditions (moisture, etc.) you will cause the signal to drop by 20-24 dB. If you’re in a strong "five bars" area, this will still leave you with more than 90, and thus still have "five" bars. If you’re sitting right around 90, dropping 24 dB can drop you all the way down to the cut off point, even though you started with "five" bars.

Passing the bar

Only, even that isn’t really the case. Because as I mentioned before, the whole concept of bars is a hold-over from analog cell phones and doesn’t really make sense in a digital world. With digital cell phones, signal is a binary condition. Either you have enough signal to make the call, or you don’t. (It’s the same way with digital TV over the air now. You either get a perfect picture or you get nothing, no more snow that kinda resembles your favorite show.) Numerous reports have shown that the iPhone 4 holds on to a call just fine all the way down to -111 dBm, and holds calls in places the iPhone 3GS would have dropped or not shown service at all.

Apple contends that the iPhone 4 has the best reception yet of any iPhone, and even with the attenuation problem factored in, this does in fact seem to be the case. Personally, I’ve lost a grand total of one call that I can blame definitively on the Death Grip. Granted, when I touched the antenna and dropped the signal enough to drop the call, I was already in an underground parking garage. o_O

Bump the Bumper

Apple raised eyebrows at WWDC when they announced the iPhone 4 by also announcing their first ever case for the iPhone, something they’d previously left to third party companies. The Bumper is a minimalist case that only covers the steel band around the iPhone, leaving the glass front and back mostly uncovered. Once reports of problems with the antenna surfaced, it didn’t take long for people to figure out that 2 + 2 = Conspiracy Theory!

Obviously, they say, Apple knew about this problem, and that’s why they’re ripping us off to the tune of $30 for a band of rubber and plastic to cover up the problem they knew they had! Those bastards!

Maybe, maybe not.

I’ll admit the Bumper is suspicious. And yes, it does seem to reduce, but not completely eliminate, the attenuation. But a wise man once advised to never attribute to malice what could be explained by simple incompetence. And I can also see not only why Apple would have offered the Bumper without knowing anything about the signal issue, but how they never would have seen the signal issue.

The Bumper is good for more than just antenna insulation. It also provides a good deal of shock absorption, something at which steel and glass are notoriously bad. An iPhone 4 wearing a Bumper is much less likely to crack or shatter when dropped to a hard surface on the corner than a naked iPhone. So Apple could have provided it simply because they knew the iPhone 4 might benefit from the extra protection.

As for them knowing about the signal issue, think about how this problem manifests and how Apple tested the phone. You don’t see it at all in strong signal areas where even dropping the full 24 dB still leaves you with five bars. And within the Apple campus at Cupertino, you can bet they have impeccable AT&T signal. So on campus, they’d never notice it.

Of course, they don’t just test it on campus. In fact, we know at least one radio baseband engineer who, while testing the phone in a bar, had a little too much German beer and wound up without his prototype iPhone 4. But we also know from that little escapade that when off of Apple’s campus, the iPhone 4 was hidden inside a specially built case that made it look like a 3GS. And holding it inside that case would have insulated the antenna, similar to how the Bumper works, which means they wouldn’t have seen it there either.

In short, Apple’s testing methodology seemed to guarantee that they’d never the test the iPhone naked and in poor signal at the same time. When they say they were "shocked" to discover this problem, I believe them. I really don’t think they tested it in all possible conditions.

Don’t hold it that way

Apparently, Apple was caught so off guard by this controversy that they they stumbled repeatedly in dealing with it in public. The first time a user emailed Steve Jobs himself about it, or at least the first (only?) one Jobs replied to, Jobs actually told the guy not to hold it that way. This struck most people as flippant and dismissive, which is probably why Apple quickly followed up with an official statement with more careful wording. BGR reported that Jobs also had a longer exchange with someone else where he ended up telling the user to get over it, it’s just a phone. Apple claims this conversation is a hoax, though BGR stands by their reporting.

What we do know is that Apple’s official stance at the time of this writing is that all phones have this issue to one degree or another, but that iOS4 has badly calibrated signal bars that don’t give people a realistic idea of how likely they are to drop a call. This seems to be true, as people have been able to grip other phones from the Moto RAZR to the Google’s Nexus One in ways that cause similar signal drops, and the "hey, my bars are dropping like flies" effect is showing up on older iPhones that have been upgraded to iOS4. Apple is not recalling the phone or even offering free Bumpers as a matter of policy. Instead, they’re going to address this with a software fix.

Can’t fix the signal, so fix the bars

Wait a second. How can a software fix resolve a physical design issue? Because, as with everything in this story, things are more complex than they seem.

The iPhone 4 handles signal differently than other iPhones. Differently than other phones, as near as I can tell. Previously, iPhones tried to home in on the strongest signal from a tower they could find. The problem is that the tower they’re closest to–thereby providing the strongest signal–might also be the most crowded. Or there might be more electromagnetic interference in that area. So even though the signal is stronger, your call quality might actually be worse.

The iPhone 4 seeks out the "best" signal, not necessarily the strongest. It looks for clarity, lack of interference, low traffic on the tower. As a result, and keeping with digital calling’s binary nature, you "do" have a signal with the iPhone 4 more often than you "don’t" compared to older iPhones, even if the reported signal strength is a lower number.

Apple is going to change the way the bars are displayed so they follow AT&T’s guidelines on how many bars to report for a given signal strength. This seems to be another source for angry misunderstanding among the digerati, so pay attention.

Counterintuitively, this change is going to show fewer bars than you had before for any but really strong signals. Where you used to have four or five bars, you might now only see two. But, and this is important, those two bars are more "durable" and a more accurate indicator of what kind of signal you’ve actually had all along. You never really had the kind of signal strength you thought you did if you used to see five bars and now you see two after installing the patch. You always had "two bar" strength, you just didn’t know it. Everyone clear on that?

Let me sum up

So. Should you hold off on buying an iPhone 4 because of this issue? If you already have one, should you take it back? That depends. Are you dropping calls? Are you dropping more calls than you did with your previous phone, iPhone or not? If not, then I wouldn’t worry about it. As mentioned above, the iPhone 4’s antenna is actually better than the 3GS at holding on to a call at low signal strength, so for all practical purposes the numbers don’t matter.

Personally, my iPhone 4 performs at least as well as my iPhone 3G, and offers so many advantages besides, so I’d be a fool to take it back. Do I use a case? Sometimes. Sometimes not. I keep mine in a Griffin Elan Passport Wallet when I’m on the go along with my driver’s license and debit card. But I take it out frequently to sync, use around the house, for use as a GPS and when typing or watching video in the Griffin Travel Stand (no, I’m not sponsored by Griffin, but I wouldn’t turn them down; I like their products). In or out of a case, I don’t notice the “problem” much. It’s just not an issue. Put aside the hype and noise, and you might see the same.