Windows Mobile: Why Persistent Storage Is A Good Thing

Mike Calligaro of the Windows Mobile Team provides some good insights as to why Persistent Storage on Windows Mobile devices is a good thing …

Here’s a quick primer on why you want Persistent Storage on your Pocket PCs.

Persistent Storage (PS) on PocketPC is new for Windows Mobile 5.0. (All Smartphones since the original 2002 release have had PS.)

Previously, your user data (email, contacts, calendar, settings, apps you installed, etc) were stored in RAM. RAM has the advantage of being really fast, but the significant disadvantage of needing a constant source of power for it to hold its data. Leave your device unplugged for long enough, and you’ll lose all your data. Fixing that was the primary reason for moving PocketPCs to Persistent Storage.

PS gives you a nice sense of certainty about your data. Batteries running low? No problem. Worst case, the device shuts off and you can’t use it again until you get to a power supply. But when you get there, it’ll boot back up and all your data will still be there.

But PS has a number of other effects that might not be quite so obvious.

Would you believe that moving to PS can double your battery life and enable devices with significantly more storage than were previously possible?

Here’s why. Remember that RAM requires power to keep its data. The amount of power needed is linear with the amount of RAM. That is to say, 64M of RAM needs twice as much power to keep it running as 32M does. 128M needs four times as much power as 32, etc. And this power drain is constant. The RAM is sucking your batteries dry while the device is in use and while it’s suspended. It even continues to drain your batteries when they are “critically low” and the system won’t let you turn it on. Also, people didn’t buy 128M RAM devices for the program space. They bought them to store stuff in. And those devices had lousy battery lives as a result.

Flash ROM, on the other hand, burns pretty much the same amount of power regardless of how much you have. A 32M flash part burns about the same amount of power as a 128M flash part does. And a 1G flash part is pretty much the same as well. So, by moving to a system where I store my stuff in flash, not RAM, I can put more storage in without requiring a bigger battery to compensate.

But wait, there’s more. Pre-Persistent Storage, Windows Mobile had what we called “the 72 hour rule.” If you’ve ever seen a PocketPC run low on batteries, at some point it pops up a dialog that says something like, “You’re running out of power, you should stop now.” If you keep using it, it’ll come back a little later with a more dire warning saying something to the effect of, “You’d better save your data now, because you’re on the verge of losing it.” Then, a bit after that it comes on and says, “That’s it, I’m shutting you down.” At that point, you can’t use the device again until you plug it in. How much battery charge do you think you have then? 5% maybe?

Try half.

Yes, when we shut you down because your batteries were “critically low,” they were still 1/4 to 1/2 full. Why? Because, if the batteries ever fully died, it would be catastrophic. You’d lose your data, and that’s, in our opinion, one of the worst things that can happen. So we made a requirement and held our OEMs to it. The requirement was that, at the point where we decided the batteries were “critically low,” they had to still have enough power to keep the RAM charged for 72 hours. The idea there was that you could discover that you were out of power on Friday on the way home and you’d still have your data on Monday when you got back to your charger.

A typical battery holds 1000mAh of charge. 128M of RAM takes about 500mAh to stay resident for 72 hours. 64M takes about 250. This is why you never saw a 256M WM 2003 device. It would have run for a minute then decided its batteries were critically low.

This is why switching to Persistent Storage can radically improve your battery life. With PS, we removed the 72 hour requirement. We’ll let you run your batteries completely dry, because we know your data will still be safe. Right off the bat, that buys you a significant chuck of time. It also means that no one ever has to make a 128M RAM device again. They can fall back to 64M devices, which burn less power, and store the user data in tons and tons of flash. You’ll definitely see 128M flash devices. And there’s no barrier to keeping you from seeing 256M, 1G, etc devices. That couldn’t have been done with RAM.

Downsides? Yes, nothing is free. Flash is much slower than RAM. Reading and writing large amounts of data will take longer on a PS device than it did on a RAM device. That initial sync that pulls down 400 contacts and 5000 emails will take longer. Some write operations will seem a bit more sluggish. But I believe you’ll find that the upsides significantly outweigh the downsides.

Mike Calligaro

[Via Windows Mobile Team Blog]