Memory Management in Win NT/2000

Abhishek

Distinguished
Apr 6, 2004
6
0
18,510
Archived from groups: microsoft.public.win2000.applications,microsoft.public.win2000.developer,microsoft.public.win2000.file_system,microsoft.public.win2000.general (More info?)

Hello,
I would like to understand the fundamental of Virtual Memory
Management in Windows 2000.
My question is does the Windows 2000 starts using Virtual Memory right from
the word go..?
For example lets say I have 200 MB of free physical memory, and I want to
execute a program which requires
a total of 10 MB of memory. Though what I know is that Windows NT/2000
allocates 4 GB of address space
to the process, but what I am not sure is whether out of 10 MB requirement
of the process, how much of the
actual physical memory is allocated to the process. Assuming there is no
other user process running on the system and
all the physical memory can be used. Now in this case whether Windows
NT/2000 would keep only a portion of the
10 MB in physical memory and rest on disk(Virtual Memory) or whether it
would put all the 10 MB in memory so that
the process has minimum page faults and thus improve performance.
I hope I was able to explain my doubt,

Thanks in advance,
Abhishek.
 
Archived from groups: microsoft.public.win2000.applications,microsoft.public.win2000.developer,microsoft.public.win2000.file_system,microsoft.public.win2000.general (More info?)

Chapter 28 - Evaluating Memory and Cache Usage
http://www.microsoft.com/resources/documentation/windows/2000/professional/reskit/en-us/part6/proch28.mspx

Abhishek wrote:

> Hello,
> I would like to understand the fundamental of Virtual Memory
> Management in Windows 2000.
> My question is does the Windows 2000 starts using Virtual Memory right from
> the word go..?
> For example lets say I have 200 MB of free physical memory, and I want to
> execute a program which requires
> a total of 10 MB of memory. Though what I know is that Windows NT/2000
> allocates 4 GB of address space
> to the process, but what I am not sure is whether out of 10 MB requirement
> of the process, how much of the
> actual physical memory is allocated to the process. Assuming there is no
> other user process running on the system and
> all the physical memory can be used. Now in this case whether Windows
> NT/2000 would keep only a portion of the
> 10 MB in physical memory and rest on disk(Virtual Memory) or whether it
> would put all the 10 MB in memory so that
> the process has minimum page faults and thus improve performance.
> I hope I was able to explain my doubt,
>
> Thanks in advance,
> Abhishek.
>
>
>
 
Archived from groups: microsoft.public.win2000.applications,microsoft.public.win2000.developer,microsoft.public.win2000.file_system,microsoft.public.win2000.general (More info?)

"Abhishek" <abhi_narulkar@rediffmail.com> wrote in message
news:%23xDidlnCFHA.2960@TK2MSFTNGP14.phx.gbl...
> Hello,
> I would like to understand the fundamental of Virtual Memory
> Management in Windows 2000.
> My question is does the Windows 2000 starts using Virtual Memory right
from
> the word go..?
> For example lets say I have 200 MB of free physical memory, and I want to
> execute a program which requires
> a total of 10 MB of memory. Though what I know is that Windows NT/2000
> allocates 4 GB of address space
> to the process, but what I am not sure is whether out of 10 MB requirement
> of the process, how much of the
> actual physical memory is allocated to the process. Assuming there is no
> other user process running on the system and
> all the physical memory can be used. Now in this case whether Windows
> NT/2000 would keep only a portion of the
> 10 MB in physical memory and rest on disk(Virtual Memory) or whether it
> would put all the 10 MB in memory so that
> the process has minimum page faults and thus improve performance.
> I hope I was able to explain my doubt,

It will try to load the whole program. This is in contrast to, say, AT&T
Unix where it would create the necessary control structures, and then "fault
the pages in" as they are referenced. Since the code is "pure" it can use
the executable for this purpose and never has to write code to the page file
because it never gets "dirty." It can throw pages way and get them later
from the executable.

I don't know if Windows is this smart, or is willing to sacrifice the
performance.
--
Jim
"Remember, an amateur built the Ark; professionals built the Titanic."
 
Archived from groups: microsoft.public.win2000.applications,microsoft.public.win2000.developer,microsoft.public.win2000.file_system,microsoft.public.win2000.general (More info?)

Windows has a demand paged memory model, like other modern OS.

Application launch has some pretty sophisticated tracing employed to track
pages faulted in in the first ~10 seconds, which are then gang-loaded in
parallel on subsequent launches. This results is some fairly dramatic
speedups. This cuts across all DLLs/resources the image touches ...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/appendix/hh/appendix/enhancements5_0eecebea-e58b-4c95-8520-9b1dc2bc6196.xml.asp

(with apologies for wording like "demands and pages")

The Windows Internals book goes into a lot more detail about the memory and
cache managers.

--
Dan Lovinger
Microsoft Corporation
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.

"Jim Nugent" <njim2k-nntp@yahoo.com> wrote in message
news:OXZ4QR7CFHA.1448@TK2MSFTNGP10.phx.gbl...
>
> "Abhishek" <abhi_narulkar@rediffmail.com> wrote in message
> news:%23xDidlnCFHA.2960@TK2MSFTNGP14.phx.gbl...
>> Hello,
>> I would like to understand the fundamental of Virtual Memory
>> Management in Windows 2000.
>> My question is does the Windows 2000 starts using Virtual Memory right
> from
>> the word go..?
>> For example lets say I have 200 MB of free physical memory, and I want to
>> execute a program which requires
>> a total of 10 MB of memory. Though what I know is that Windows NT/2000
>> allocates 4 GB of address space
>> to the process, but what I am not sure is whether out of 10 MB
>> requirement
>> of the process, how much of the
>> actual physical memory is allocated to the process. Assuming there is no
>> other user process running on the system and
>> all the physical memory can be used. Now in this case whether Windows
>> NT/2000 would keep only a portion of the
>> 10 MB in physical memory and rest on disk(Virtual Memory) or whether it
>> would put all the 10 MB in memory so that
>> the process has minimum page faults and thus improve performance.
>> I hope I was able to explain my doubt,
>
> It will try to load the whole program. This is in contrast to, say, AT&T
> Unix where it would create the necessary control structures, and then
> "fault
> the pages in" as they are referenced. Since the code is "pure" it can use
> the executable for this purpose and never has to write code to the page
> file
> because it never gets "dirty." It can throw pages way and get them later
> from the executable.
>
> I don't know if Windows is this smart, or is willing to sacrifice the
> performance.
> --
> Jim
> "Remember, an amateur built the Ark; professionals built the Titanic."
>
>
>