Solved How does a pagefile work?

Acer / Aspire x3810
January 20, 2013 at 10:00:15
Specs: Windows 98 SP1, 1.33 Ghz / 256 MB
Hi, I woundering how a pagefile works. I know what it is doing, but how does all the information being stored? In the RAM, it gets fragmented, but it is not a problem, cause the RAM works like an SSD. But do the pagefiles content gets fragmented?

If you did'nt understand read this:

If you run a virtual machine with Windows. The hard drive file on the host computer file system can get fragmented. (This is the pagefile.sys)

On the guest operating system, that in this case is Windows, it also gets fragmented. (does this happend inside pagefile.sys?)

See More: How does a pagefile work?

Report •

January 20, 2013 at 10:18:50
✔ Best Answer
Yes, pagefiles can get fragmented and that affects performance. Fragmentation of RAM also causes problems, for different reasons. The Wiki article is a good starting point for further research:

Report •

January 20, 2013 at 10:25:59
"how does all the information being stored"
Not sure what you are asking. Page file is on the hard disk and it is used as and when required. It is a reserved area and I've not found mine fragments at all. It might if your RAM is minimal.

Always pop back and let us know the outcome - thanks

Report •

January 20, 2013 at 10:35:36

The file pagefile.sys on the hard drive can get fragmented. That problem can be solved by a program called pagedefrag.

But inside the pagefile there are data stored. And if I could open the pagefile, and view it's content and how much of that data being fragmented.

Report •

Related Solutions

January 20, 2013 at 11:17:52
For starters, you need to understand what the pagefile aka swap file aka virtual memory is used for & why:

When your system runs low on RAM because an application like Firefox is taking too much memory, Windows moves the least used "pages" of memory out to a hidden file named pagefile.sys in the root of one of your drives to free up more RAM for the applications you are actually using. What this actually means to you is that if you've had an application minimized for a while, and you are heavily using other applications, Windows is going to move some of the memory from the minimized application to the pagefile since it's not being accessed recently. This can often cause restoring that application to take a little longer, and your hard drive may grind for a bit.

NOTE: In Win9x systems it's named Win386.swp, but in newer systems (Win2k & up) it's named pagefile.sys.

Remember that virtual memory is extremely slow compared to RAM. There is no substitute for physical memory. No amount of tweaking of the virtual memory settings can make up for a lack of RAM. And there is a LOT of bad advice out there on how to configure the virtual settings. Generally, the best thing to do would be install as much RAM as possible (depending on the OS) & just let Windows handle the virtual memory. The only "tweak" that will increase virtual memory performance would be to put it on it's own partition on a separate hard drive.

BTW, don't confuse virtual memory & virtual machine, they are 2 completely different things.

Report •

January 20, 2013 at 12:20:48
I didn't explain Virtual memory because in your original post you said "I know what it is doing". I therefore wondered what you were asking.

RE #3
Yes, I know the pagefile can get fragmented I was only saying mine didn't. I also have pagedefrag onboard (I'm not a newbie LOL) but I don't ever need to use it. Another way is to delete the paging file and let it build a new one on reboot. That will then be contiguous.

I can't imagine why you need to peer inside the pagefile or what you expect to learn from its contents, as it is just system handling about which you have little control. There are programs that give a graphic of the hard disk and will show how fragmented the paging file happens to be. In practice none of this is going to affect performance in any significant way and if it really bothers you just defragment it by the method of your chosing - it only takes a few seconds.

Always pop back and let us know the outcome - thanks

Report •

January 20, 2013 at 18:40:42
The pagefile can be fragmented to the point it impacts performance. But this is rarely a serious issue and in most cases it isn't an issue at all. File fragmentation is a problem with large files that are accessed serially. That is not how the pagefile is accessed. Most pagefile access consists of relatively small reads from various parts of the file and mixed with other file access. Reads from the pagefile will rarely be in the same order they were written.

The pagefile is used as an area to offload rarely used data, leaving more RAM for more important uses. It is not some kind of overflow area used only when RAM is used up. That would be highly inefficient. There is a great deal of nonsense on the Internet concerning the pagefile.

Report •

January 20, 2013 at 21:03:54
Looking at the specs you have listed, I see you are running Windows 98 with 256 RAM. Is that correct? I don't care what you do with the pagefile. It's not going to help very much.

How do you know when a politician is lying? His mouth is moving.

Report •

January 20, 2013 at 23:42:41
#6 - Mark Russinovich, who knows more about the internals of Windows than any of us, says that pagefile fragmentation affects performance (and the same holds true for the Registry). That's good enough for me.

Report •

January 21, 2013 at 05:13:40
I specifically said that pagefile fragmentation could effect performance. I just wanted to emphasize that it wasn't a common situation. Most people concerned about pagefile fragmentation don't have it to any significant level.

Report •

January 21, 2013 at 06:50:40

Report •

January 21, 2013 at 07:08:25
Everyone needs to be clear on what type of fragementation we are talking about.

There is where with "system managed" you end up with multiple pagefile fragments. This has a serious impact on performance. This is also why on servers it recommended to set min and max values the same and static so a block of contiguous space is allocated just for the pagefile. At which point the pagefile will not grow or shrink dynamically.

Then there is fragmentation within the pagefile but this has little or no impact on performance since this is handled by the memory manager as it pages out and back in the stored information.

"If you run a virtual machine with Windows. The hard drive file on the host computer file system can get fragmented. (This is the pagefile.sys) "

AKDOS I have to think you inserted the "this is the pagefile" because that is not what the statement is talking about. It is talking about the actual VM file getting fragmented which causes poor performance of the VM

"RAM works like an SSD"

Actually it doesn't. Ram is far more dynamic than what happens on a ssd drive.

Answers are only as good as the information you provide.
How to properly post a question:
Sorry no tech support via PM's

Report •

January 21, 2013 at 08:23:22
My Virtual Memory is system managed but the page file hardly changes in size. It may be partly because I have plenty of RAM. From bootup I am only using about a quarter of RAM - obviously this increases with usage.

Windows managed Virtual Memory versus a saved block has always been a bit controversial. It all depends on computer usage but I still think that for most people Windows managed is fine. Page file de-fragmentation can be quickly dealt with (as already given).

Whatever I'm definitely not going to go against Mark Russinovich, whom I too regard as the leading expert.

Always pop back and let us know the outcome - thanks

Report •

Ask Question