Hi,
I have the following question wrt Memory Management for win2k ([Inside
Windows 2000]).
In the second level page tables for a given process, lets say an entry
points to a page frame which exists in the memory. For example virtual
address 0x5001, its
being actively used by the process and say it maps to phyical page frame
2000:3024. Therefore the second level Page table entry points to this page
frame along
with access rights. When this process is context switched out, I am
assuming the page tables get swapped out too. when this
process is executed again, the page tables will be brought in and the second
level PTE for 0x5001 will point to 2000:3024 but with V=0. (rite?) Access of
this
address will page fault and the actual page will be brought in from disk. My
question is: “will the page corresponding to 2000:3024 on disk be brought
into
2000:3024 and therefore not have to change the PTE entry OR will the page
replacement policy [Inside Windows 2000] place the disk page some place
decided
in the memory and update the PTE to point there”
If it is the later, then what purpose would saving the PTE tables to disk on
context switches serve? Since the PFN that it points to will anyways not
hold when
the process is brought back in.
thanks
Kutty
Windows does not outswap the pages due to context switch. It even does not
decrement their reference counts due to this. Pages are made outswappable only
by the working set trimmer thread, and even not outswapped, but excluded from
the working set - refcount decremented.
If all threads in the process were waiting on something for some long
time - then the trimmer will trim this process’s working set to zero, thus
allowing all of it to be outswapped if physical memory starts to become low.
As about the page tables - they become outswappable (refcount == 0) only
when they contain no valid PTEs.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Hi Maxim,
Windows does not outswap the pages due to context switch.
That answers a major chunk of my question. But is there a way to be sure of
this? Inside Win2k does not
appear to say so.
It even does not
decrement their reference counts due to this. Pages are made outswappable
only
by the working set trimmer thread, and even not outswapped, but excluded
from
the working set - refcount decremented.
So pages belonging to blocked process’ working set stay in physical memory?
In other
words with 200 processes, the memory contains the WS for all 200 of them,
assuming
you dont hit low memory.
As about the page tables - they become outswappable (refcount == 0)
only
when they contain no valid PTEs.
So at the least we have the first level page table for all processes in
memory. Is there a max
memory that windows is ready to use for holding page tables (any variable
that windbg can expose)
purely for academic reasons and no i m not trying to get a driver to use
these concepts:-)
thanks
kutty
> > Windows does not outswap the pages due to context switch.
That answers a major chunk of my question. But is there a way to be sure of
this? Inside Win2k does not
appear to say so.
No OS does this. Such a thing is a gross stupidity.
So pages belonging to blocked process’ working set stay in physical memory?
In other
words with 200 processes, the memory contains the WS for all 200 of them,
assuming
you dont hit low memory.
Trimmer will be activated on hitting low physical memory and will trim these
processes. More so, if all threads of the process are waiting for some long
time, it is trimmed to zero - possibly even if there is no low physmem
situation.
So at the least we have the first level page table for all processes in
memory.
For all processes which are not trimmed to zero. If the process is trimmed to
zero - then even this page can be outswapped.
memory that windows is ready to use for holding page tables (any variable
that windbg can expose)
I don’t think there are such limits.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com