Re: swap files question.
Re: swap files question.
- Subject: Re: swap files question.
- From: Mike Fischer <email@hidden>
- Date: Sat, 4 Sep 2004 13:08:58 +0200
Hi Dieder,
Am 04.09.2004 um 03:06 schrieb Dieder Bylsma <email@hidden>:
Is there anyway to determine which program/process is paged out to a
particular swap file?
Err, I'm not a Darwin expert but AFAIK it doesn't really work that way.
The vm system pages out single memory pages (4096 byte blocks of
memory) not processes as a whole. So pages from a single process could
be paged out to multiple physical swap files. And most likely a process
will never be completly paged out. Only the least recently used memory
goes to disk when RAM is needed.
Also some of the address space of a process may be memory mapped to
other files. These parts are usually (but not always) read only and
will not be written out to disk. They are simply discarded and reloaded
later when needed.
And another point to note is that the location of a paged out memory
page may change over time. Consider for example the case where 4 swap
files of 64MB each are in use. Something happens on the system so that
lots of memory gets freed and thus more than 128MB of swap space are
left available. dynamic_pager will unregister a swap file in such a
case and cause the vm system to empty the file of any in use swap
space. Due to the fact that the remaining paged out memory is scattered
across all 4 swap files the vm system needs to move pages around in
order to empty one swap file so it can be deleted. (This is probably a
bit oversimplified. I am guessing that when "relocating" paged out
memory the system will probably reload them into RAM and then decide in
a separate step that some memory needs to go back out to the swap
files. This may or may not be the same pages just loaded from the soon
to be obsolete swap file.)
This example assumes a non-standard setting for the dynamic pager in
Mac OS X 10.3:
dynamic_pager -H 33554432 -L 134217728 -S 67108864 -F
${swapDir}/swapfile
similar to the settings in 10.2. The standard 10.3 configuration
creates swap files with increasing size instead of fixed size as in
this example but for demonstration purposes this is easier to handle.
Finally note that the paged out memory will probably be completly out
of order in the swap files. You'd have a hard time piecing it back
together even if you knew where it was located.
So why do you need to know where paged out memory pages are located?
If it's security you're after then it would be a better idea to prevent
critical data to be paged out and erase its (RAM) memory right after
use.
HTH
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web: <http://homepage.mac.com/mike_fischer/index.html>
Note: I read this list in digest mode!
Send me a private copy for faster responses.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.