Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I've been reading up on virtual memory and it all seems pretty straight-forward and practical. However, I'm choking on one major concept.

If virtual memory is stored in main memory, then why even use it in the first place? Why not just use main memory?

I'm sure I'm missing something here, just don't understand what yet.

share|improve this question
> If virtual memory is stored in main memory … I think that's the part where you would have to re-read again. –  slhck Sep 21 '11 at 14:34
Think of it as Virtual memory address spaces and physical memory address spaces. Each process thinks it has 4GB of "virtual address because the processor isolates the processes from each other. –  surfasb Sep 21 '11 at 21:56

2 Answers 2

up vote 6 down vote accepted

Virtual memory can be stored in RAM, but it can be swapped out to disk when another process needs the physical RAM. This is one of the significant features. Once it is on disk, other processes can use the system RAM to speed their processing. When needed, the memory swapped to disk can be reloaded and something else moved their in its place.

Many of today's computers have more RAM than they need so swapping is minimized (it can hurt performance), but it is good to have the swap option when needed.

share|improve this answer
Thanks uSlackr! –  pnongrata Sep 21 '11 at 14:49

Virtual memory allows you to concurrently run 10 x 1 GB applications in a 2 GB computer.

Demand Paging

Instead of loading the program into memory and giving it some memory for data, VM allocates space on disk (the paging file, or equivalent) for the memory needed by the program but uses "demand paging" to only load into real memory the smaller part of the program and data needed at any point. Less used parts (e.g. some rarely used subroutines) might never be loaded into real memory. When real memory is needed for another program, unused parts of real memory are used, if none, oldest clean pages may be dropped, if no clean pages remain, some "dirty pages" of memory are written out to the paging file (if the page is the same as the original loaded from the program binary file, we don't need to save an extra copy). VM keeps track of all this.


In the past, a separate and more desperate method of memory management called swapping was also sometimes needed. Nowadays the terms are used almost synonymously.

share|improve this answer
For some definitions of "run", anyway. –  grawity Sep 21 '11 at 16:18
@RedGrittyBrick What you meant by clean and dirty pages? –  Geek Apr 23 '14 at 6:35
@Geek: Clean pages are pages that have not been altered since being allocated or loaded from disk. So there is no need to save their contents to disk before using them for another process. Dirty pages are pages that have been written to by a process, so their contents must be saved before reusing that memory for another process, so that the page can be restored when the original process gets resumed. –  RedGrittyBrick Apr 23 '14 at 8:15
@RedGrittyBrick Thanks for the clarification. –  Geek Apr 23 '14 at 10:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.