Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One thing to keep in mind with this talk of virtual memory is that current smartphones and tablets have basically regressed to the 1975 model when it comes to swap. That is to say, there isn't any. If you take the approach of "allocate plenty of memory and let the kernel sort out what should go to disk" then you'll end up killed by the OS if you're running on e.g. an iPhone, because there's no swap.


Coming from iOS:

You still get memory-mapped file I/O. There's no swap file, but you can still map files into virtual memory and the OS can page pieces in and out as necessary.

Virtual memory isn't just about swap.


The point is: you still have to make a conscious move to prevent memory overload.


I know that VM is more than just swap, but the way it was used in this article, it pretty much only discussed swap.


"Varnish allocate some virtual memory, it tells the operating system to back this memory with space from a disk file."

I'm pretty sure the article's talking specifically about mapping a gigantic file into memory and pretending it's all in RAM, and isn't talking about swap at all.


It's hard to tell whether they mean that it's done explicitly or not:

"...all we need to have in Varnish is a pointer into virtual memory and a length, the kernel does the rest."

If you're manually memory mapping stuff, you'd need more than that. In any case, the first part of the article is definitely talking about swap when it comes to fighting with the kernel over whether something should be in RAM or on disk. Explicitly memory mapping a large file will work on iOS, although the lack of sparse file support on the filesystem would seem to make it painful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: