how-to block ads
Contrary to what some people might tell you, virtual memory doesnt mean disk. Its a bit more subtle than that. Programs see nothing but virtual memory. Sometimes pieces of the virtual memory are held in real memory, sometimes theyre held on the disk, and sometimes theyre nowhere, because no-ones looked at them yet, even though theyre virtually there. The point is that the program does not know the difference; its just memory. Or at least, it behaves as if it were memory, which is why its called virtual memory.
Q2. Why have virtual memory?
Virtual memory removes the limitations imposed by a fixed-size RAM. Adding more RAM is no longer a way to allow you to run bigger programs; theres no such limit. Adding RAM has become a way to make your system run faster (up to a point), because there will be less shuffling between disk and RAM.
Q3. Where is the virtual memory stored on disk?
Which is to say, where is the content of a piece of virtual memory stored when its not held in RAM? It has to be kept somewhere; the system cant just forget about it. Some data (e.g., program instructions) came into memory from the program .exe file, and wont have been changed. So, theres already a copy on disk (in the .exe file) and we dont need any other copy. Other data (e.g., working results) must be written out to a file called the page file that exists for exactly this purpose. Its called the page file, by the way, since virtual memory is considered to be divided into pages (4096 bytes on Intel PCs). In Windows XP, there can be more than one page file, on different disks. Each one is called pagefile.sys.
Q4. How big should my page file be?
I dont know. It depends. What it actually depends on is how many programs you run at the same time, how large those programs are, and things like that. What it doesnt depend on is the size of your RAM. Remember how I said the memory contents were either held in RAM or in the page file (approximately speaking)? It follows that if more RAM is added, youll have more room in RAM, so youll need less space in the page file, and not more.
Many people, including Microsoft, tell you something like one and a half times the size of RAM in answer to this question. Theyre wrong. Perhaps this was a good rule of thumb when memory was expensive, but it no longer is, but the old rule is being repeated with no reasoning behind it.
On the other hand, theres no need to spend a lot of time worrying about this. Theres no real penalty for having too large a page file; disk space is so cheap. And if you make it too small, then eventually youll get a message telling you youre running low on virtual memory, at which time you can make the page file larger. Either way, nothing really bad happens.
My advice would be to allocate a 500 or 600MB page file, fixed size (minimum = maximum). I do it that way because I dont see any benefit in giving Windows the ability to extend the page file; its easy enough to just make the file larger in the first place.
Q5. Who invented this idea, anyway?
Tom Kilburn and his team at Manchester University (link), somewhere around 1959 or 1960.
Q6. Where else can I read about virtual memory in Windows XP?
This is a good page: Virtual Memory in Windows XP
and another: RAM, Virtual Memory, Pagefile and all that stuff
Feedback received on this FAQ entry: