Page FIle and Virtual Memory question

D

DaleD

Here is the situation: The page file (for testing) has
been reduced to 2mb (yes, 2 megabytes) and the system has
been rebooted. When I go into Task Manager, Processes
tab and add the VM column, one process is using 76,496k
of physical memory, and 70,580k of Virtual Memory. Are
the page file and virtual memory the same thing? If yes,
how could the process use that much virtual memory when
the page file is set to 2mb?
 
P

Phil Barila

DaleD said:
Here is the situation: The page file (for testing) has
been reduced to 2mb (yes, 2 megabytes) and the system has
been rebooted. When I go into Task Manager, Processes
tab and add the VM column, one process is using 76,496k
of physical memory, and 70,580k of Virtual Memory. Are
the page file and virtual memory the same thing? If yes,
how could the process use that much virtual memory when
the page file is set to 2mb?

That's a simple question with a complicated answer. The short answer is no,
VM isn't the same as the page file. However, in *most* cases, the amount of
VM memory the app is using is roughly equivalent to the amount of pagefile
space reserved for that app.

VM is the memory an application can address. Normally, the application has
2 GB of address space, though not many systems have that much physical
memory. In addition to the 2 GB the app can address directly, there is
another 2 GB of kernel-mode address space. This is where the kernel and
drivers are located in the process address space. Most of the kernel is not
pageable, meaning that it must remain resident in physical memory. How much
is dependent on what hardware you have (peripherals, main memory, number of
processors...).

So how does an app use 2 GB of virtual address space when there is less than
2 GB of physical memory? Enter the pagefile, which is a way of providing
additional storage so that physical memory can be used for multiple
processes (apps). Imagine you have 512 MB. For pursposes of convenience
only, lets assume that the total non-pageable kernel memory is 64 MB, so the
physical memory available to an app is 448 MB. Imagine that you have a
large enough pagefile to hold all the running apps, plus another 2 GB, say 3
GB. Now you run an app that consumes every last byte of that 2GB address
space. The app will take up the available memory. Then most of the other
applications will be copied to the page file (paged, or swapped), and the
memory where they resided will be reused for the greedy app. After there is
no more physical memory to be taken from any other application (the app
consumes all 448 MB of available physical memory), the system will start
swapping data from this app into the pagefile, so the app can do whatever it
needs to do on the data that's still in memory. As the app needs data
that's in the pagefile, the system copies data out to the pagefile, copies
the needed data into physical memory, and changes the virtual address map to
reflect this. It's very messy, quite slow when the VM system is way
over-commited, and this explanation is a gross over-simplification of the
whole thing, at that.

Inside Windows 2000, 3rd Edition, by Solomon & Russinovich, MS Press, has a
really good explanation of the VM system. There's a lot of information
available in MSDN, too.

Phil
--
Philip D. Barila Windows DDK MVP
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.
E-mail address is pointed at a domain squatter. Use reply-to instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top