Skip to content

Comment on John Gruber: The iPad

Comments

The iphone and ipad lack virtual memory? They can't be serious... it's a Mach kernel. Maybe he means swap?

That explains the lack of multitasking. Multitasking would work if background apps just swapped to disk and slept. The current guidance for developers (on exit, save state; on startup, restore state) is a poor man's version of swap.

Android encourages this as well. With respect to multi-tasking, swap is an abstraction to save developer effort at the expense of performance and persistence.

Yup: http://news.ycombinator.com/item?id=1240171

I also wonder how useful virtual memory would be on a device like iPad/iPhone. With limited memory and no multitasking how often would address fragmentation be an issue.

Virtual memory (memory paging and segmentation) is the foundation for being able to start and stop apps. Otherwise memory would have to be defragmented. Both don't require the ability to store somewhere, they both are useful in physical memory only situations.

I think what he means in the article is that Apple disabled Mach's ability to store memory pages on disk in order to free room for more physical memory. The most probable reason being that Apple does not trust the lifetime write capacity of their Flash disk. (And depending on your chicken and egg, the current App situation does not require swapping memory pages to disk since you can only run one App at a time. Which caused the other I don't know.)

I'd guess the most probable reason is to reduce interface stuttering.

Interface stuttering due to swap is an issue on PC's due to hard drive latency, but would it be as much of an issue with solid state storage?

Well, even assuming that they're using top quality solid state storage, you're going from (at worst) hundreds of nanoseconds per retrieval to (at best) a hundred microseconds per (page) retrieval. Still very significant for some data access patterns.

My question wasn't about the article.

My question was how much fragmentation is there on iPhone to warrant VM. It has fixed memory and runs only one app at a time (mostly).

Without virtual memory, you run into memory fragmentation issues quickly, especially with allocation-happy object oriented code. Multitasking or not makes no difference.

Why address fragmentation? The kernel's running with virtual memory on. Just no paging files.

Why exactly was this downvoted? I'm not trying to justify the lack of multitasking, just pointing out how it's consistent with the lack of swap.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.