What is Pagefile & Virtual Memory in Windows?

Windows Pagefile (pagefile.sys) & Virtual Memory


What is Windows Pagefile & Virtual Memory

Ever wondered what happens when the total memory usage exceeds the amount of available RAM?

When the total amount of RAM used by your active programs exceeds the amount of RAM installed on your computer, Windows starts moving the data of the least active or minimized programs from RAM to a file called pagefile.sys located on your Hard Disk Drive. This transfer of data is done to make space for the active programs or the programs that you want to use. This is also done to prevent the applications from crashing, which would mean the loss of data.

The data is moved in the form of 4-KB pieces called Pages. So, the least used pages (or program data) are moved from RAM to HDD. When you try to use a program whose data is currently paged, Windows transfers its contents from HDD to RAM, and to make space for this program, moves the contents of some other program which is inactive or not being used to the pagefile.sys file.

Explaining the Need for Paging with an Example

Considering a scenario where the user has 1GB of RAM installed on his computer. The user has opened four programs, which are using a total of 800MB out of the total 1GB of RAM. This leaves only 200MB for other applications that the user may want to run along with these four programs. The user opens a web browser that requires more than 200 MB of RAM to run properly.

  • In this case, if paging is disabled, and the user decides to run another application, for example, a web browser, then sometime after opening that program, Windows will start displaying the Your computer is low on memory warning message for other programs. This is because now there is not enough RAM available for all of the programs to run, and the user will have to close other programs to make space for his web browser.
  • If paging is enabled, then the data of the least used of inactive or minimized application is paged or moved to the pagefile.sys file stored on the hard disk, and the user is able to use his web browser.

Advantages & Disadvantages of Using a Pagefile or Virtual Memory

Advantages of Using Page File or Virtual Memory

Paging is an important memory management feature in Windows, and should never be disabled.

  • No Program Crashes – Using paging means that there is always some backup space for storing the data of inactive programs in case the total amount of memory required exceeds the total amount of available memory.
  • Memory Dumps – A paging file is used for storing Memory dumps that can be used for troubleshooting purposes.

Disadvantages of Using the Virtual Memory as a Substitute for RAM

There are no disadvantages of keeping the paging enabled. You should never disable paging, but at the same time, never substitute the Page File or Virtual Memory for Real Memory (RAM) installed on your computer. Virtual Memory is neither an alternative nor a replacement of Main Memory.

  • Sub-par Performance – The performance that uses Virtual Memory as a substitute of RAM is never the same as using the proper RAM. Wherever you open a program whose data was paged, you’ll notice poor response rate from your disk. The time taken to restore the contents of a minimized program whose data was paged is much more than the program whose contents were stored in RAM.
  • HDD Impact – There is too much impact on your Hard Disk Drive. Constantly moving data back and forth from RAM to HDD affects the lifetime of your HDD. Every time you maximize a minimized program whose data was paged, you’ll notice that the transition of the window from being minimized to maximized is not smooth at all. It is because there is an extra impact on your Hard Drive.

Leave a comment