Hacker News new | ask | show | jobs
by carbocation 5918 days ago
> "Both the iPad and iPhone, as mobile devices, have limited memory (256MB in the current incarnations) and no hard drive. No hard drive means no swap file."

He loses me here. My iPhone has a 32GB SSD hard drive. Sounds like a perfect medium for swap space to me...

8 comments

Yeah, that's poor wording.

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!

The jerkiness and stuttering has always been a PC/DOS/Windows issue. Not a computeriness issue, unless you only have computer experience

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.

"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.

I didn't mean the resulting action might not take a moment, I meant the actual movement of the switch.
Obviously you've never used an Amiga.

No swap file + no virtual memory + lots of stuff pre-cached onto RAM disk = snappiest user experience ever.

It scares me to think that I now days open, without blinking, some JPG that would eat up all the memory available in that poor Amiga.

But, ah...

  lea bbye,a0
  move.l (a0),$80
  trap #0
  rts
(to take it back on-topic)
Older Palm Treos (up to Treo 600 if I'm not mistaken) had everything in RAM and I remember upgrading to a newer, supposedly better Treo - and everything but the lag was...
> My iPhone has a 32GB SSD hard drive

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.

Swapping has been demonstrated to be seriously detrimental to the life expectancy of solid state drives.
Has it? Everything I've read that is not just speculation has concluded that you'd have to constantly write a great deal of data to wear out an SSD, even with a swap partition (or file).

http://serverfault.com/questions/23720/should-you-disable-pa...

SSD drives have substantially longer life than embedded flash drives since they are SLC, meaning each bit is represented by one cell. Embedded flash devices are MLC, meaning each cell represents multiple bits. Your drive's life expectancy goes down dramatically with each bit you try stuff into a single cell.
Are you sure? I thought most non-enterprise SSDs are MLC.
But what's the life expectancy of smartphones and the likes? I wonder if flash storage in them could die so quickly - even before such a device itself would become obsolete.

If it's correct that at least Palm's webOS and Maemo dare to swap on flash storages, we shall see soon...

The N900 has swap, and I think that's why it becomes completely unresponsive from time to time.
His tweet seemed to indicate that this is a bad idea:

http://twitter.com/rlove/statuses/11609100128

What I'd like to know is why this is a bad idea...
would anyone care to predict what the memory specs of an iphone-like will be in 5 years?
Perfect? Sounds awful to me. Few things will use up a SSD's wear cycles faster than active swap, and I doubt Apple wants to go out and buy good SSD's with many write cycles. That would eat into profits.

(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)