5 ms·
"Virtual memory - useless with 4GB RAM" So when, if ever, are we going to see it disappear? (If disks are always going to be cheaper than RAM?) Some kernels
by thereason 14y ago
"Virtual memory - useless with 4GB RAM"
So when, if ever, are we going to see it disappear? (If disks are always going to be cheaper than RAM?)
Some kernels allow you to disable swapping to disk, and others run quite well without any swap, but this the notion of "swap" still seems tightly integrated into most OS's. And I'm still seeing gimmicks like "Increase your system memory with [some catchy product name, but is actually nothing more than a multi-GB USB stick you plug in to give you more swap]."
Will we ever move beyond the concept of swapping to disk?
- joshu 14y agoSwapping is a different aspect of virtual memory. Instead what we are talking about is having each process appear to have its own memory address, where virtual addresses are translated to different pages that may or may not be backed to specific physical RAM.
- thereason 14y agoSo he is addressing the fact it's still difficult to have the full 4GB "addressable"? Just trying to understand his comment.
- shabble 14y agoNo, the major benefit of virtual memory is simplicity for applications. Instead of having to be aware of everything else in memory, and carefully allocating around other things and taking care not to step on each other, it can just assume that nothing else exists, and it has the whole addressable range to put things where it likes. This isn't really true of course, it's a bit like being given a magical chest-of-drawers in which both you and your friends can use the same drawer, but every time you open it, it only has your own things inside. And behind the scenes, there's a little imp shifting stuff in and out depending on who's pulling the handle. The virtual addressing part is the sharing of those drawers, the swapping part is if, instead of having only 4 drawers, there are now 8, or 16, or any number. If you open one of these drawers that doesn't actually exist, the imp rummages around in a bigger box in the next room, finds it, and fills whatever is meant to be there. He also sedates you if this happens, so the change appears 'instant' to you. Because going into the other room is slow for him (and also you, but you might not necessarily notice because you're unconscious) he keeps a bunch of the most recent or most common things around close to hand on his side of the drawers so he can swap them quickly. Every time you need something that isn't nearby, he has to take something out with him to make space, and come back with the new thing. There's a reasonable argument that this latter part (swapping) can be optional - you don't really have infinite memory like you're pretending, it's still limited to either the amount you can address, or the amount you can store in your secondary storage. And, comparatively, the secondary storage is really damn slow. But, for those occasional times when you just pass the limit, being able to handle that without crashing or the kernel arbitrarily nuking something to make space, it's useful.
- thereason 14y agoThis reminded me of Tim OReilly trying to explain how sed works back in the 1980's. In his case it was a monk/scribe instead of an imp. Nice work. Is the sedation COW?
- shabble 14y agoNo, I was going for Page Fault[1], which, if I recall my comp. arch. lectures, suspends the requesting process until the required page has been read from disk and put in memory somewhere. So wall-clock time passes, but the process itself doesn't know about it until it resumes. Even then, I don't think it can know definitively why it was suspended - it could just as well have been pre-empted by some other task. [1] https://en.wikipedia.org/wiki/Page_fault https://en.wikipedia.org/wiki/Page_fault
- wmf 14y agoLooking at the article... "A single bit in the descriptor can be used to specify whether the array (or other segment) is actually in core or not (the 'presence bit"). Bingo! Virtual memory." This is really swapping, not virtual memory as we understand it today. While memory protection and translation are essential IMO, I agree with other commenters that swapping is mostly obsolete.