SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Pastimes : Dream Machine ( Build your own PC ) -- Ignore unavailable to you. Want to Upgrade?


To: Dave Hanson who wrote (3551)11/15/1998 8:42:00 PM
From: Spots  Read Replies (2) | Respond to of 14778
 
I from your second post that an NT pagefile does not act like a win
3/9x swapfile in that it acts as virtual RAM? If it did, it'd be hard to
see why a swapfile smaller than physical RAM size wouldn't help by
simply adding that much more space to available RAM


It does act like virtual RAM, just as the Win 3.1 swapfile did.
My comment in comparison was to the effect that NT manages it
better.

BUT what I said is true. Virtual memory doesn't ADD to available
memory, it EXTENDS available memory. If you don't provide
more virtual memory than (pageable) real memory, you haven't
extended real memory at all. The OS maps the virtual address
space provided by the swap space into process memory space.
That is, assuming the swap space is larger than pageable real
memory. If it's not, you gain nothing from virtual memory
anyhow.

In NT the swap space is the aggregate of the disk swap files,
though other OSs vary in just how the mapping between swap
space and memory is done.

For example, let's assume that
pageable real memory is 200mb and swap space is 500mb. Then
the virtual memory available to processes is 500mb. Suppose
process (pageable) memory (memory commit in NT terms) is at
some point say 400mb, and for simplicity suppose that all
real memory is allocated to some process (not true,
necessarily, but suppose).

Under this assumption, each page of 200mb swappable real memory
will be mapped to SOME page of the disk swap space; another
200mb of process pages will be unmapped to real memory, but
still mapped to a page in the swap file.

If a process accesses a memory mapped page (a "resident" page
in its address space), it will find that page in memory
and access it normally.

If, however, it accesses a page in it's address space that
is NOT in real memory, a page fault occurs, and the OS must
bring a page in from the disk swap space and map it to
the address space page the process referenced.

But remember the assumption that all swappable memory pages
were mapped to some process. Now the OS must unmap SOME
page from real memory, write it (i.e., "swap" it) to disk,
read in the referenced page, mape it to the process address
space at the referenced page address, then return to the
process to try the memory reference again. This is
page fault processing (or "paging").

BUT where did the OS write the page it removed to make
room for the page it brought in? To the swap space.
There's nowhere else for it to go. Where in the swap space?
Well, not to the place where the newly referenced page is,
because it hasn't been read in yet (we need to make room
for it by writing some page out). The answer is, it is
written to a place pre-mapped to that page in the virtual
address space provided by the swap space. But this means
that every allocated real memory page is always mapped
to some page in the swap space
. That is, the
swap space is always real memory PLUS an extension to real
memory to give virtual memory.

Now it's possible
through various swapping algorithms to reduce this absolute
requirement a bit, but the cost of doing so is prohibitive
because the OS ends up juggling disk records when memory
demand gets critical, exactly at the time when it's essential
that the paging process be most efficient. There are
theoretical studies on this, but I don't know of ANY real
OS that does it. Heck, disk is cheaper than memory, and
memory's made of dirt nowadays (i.e., silicon <g>). In
other words, forget that. The virtual address space
is always the total size of the swap space, including
real memory (assuming it's bigger than real pageable
memory, of course).

Sorry, again I've gone on too long (I have this on my
wife's authority too <gg>), but I hope the gist
is clear. I apologize for the many words, but it is
a bit obscure if you don't live with it.

I'm sure much of this is unclear. Questions please.

Spots