[comp.os.vms] Swapfile vs. Pagefile

jbs@eddie.MIT.EDU (Jeff Siegal) (10/20/87)

What is the difference between adding a secondary swapfile and adding
a secondary pagefile.  The documentation says that both files can be
used for swapping or paging.  

Our situtation is that the system never pages (well, almost never),
but has been running out of swap space.  Actually, it has been
reporting that the swap space is badly fragmented.

Should we add a swapfile or a pagefile, and why?  

Also, given that our system never swaps or pages, does it matter (in
terms of performance, I guess) that we don't have enough contiguous
space for the secondary file (and have been creating it
non-contiguously)?

Jeff Siegal

leichter@VENUS.YCC.YALE.EDU ("Jerry Leichter") (10/20/87)

	What is the difference between adding a secondary swapfile and adding
	a secondary pagefile.  The documentation says that both files can be
	used for swapping or paging.  

While you can indeed swap and page to the same file, you should avoid doing
so:  The two uses require different kinds of internal allocation algorithms
that don't mix well.  Pagefile space is allocated in small chunks, but
swapfile space must be allocated in virtually-contiguous pieces.  The result
is that unless the combined file is very large, it will often be too fragmen-
ted by allocations for paging to allow the required allocations for swapping
to be made.  (Note that this is an INTERNAL fragmentation of the virtual
address space of the file; it has nothing to do with EXTERNAL fragmentation
of the physical space allocated for the file by the I/O system.)

	Our situtation is that the system never pages (well, almost never),

That's VERY unusual; I don't think I've ever seen such a system!

	but has been running out of swap space.  Actually, it has been
	reporting that the swap space is badly fragmented.

I'd bet you are doing your swapping and paging into the same file now.  Don't.

It's important to realized that swapfile and pagefile space must be allocated
BEFORE they are actually needed - if VMS waited until it KNEW there was a need
it could of deadlocks.  So even if you NEVER swap or page, your processes have
space reserved for them.

	Should we add a swapfile or a pagefile, and why?  

Have enough page and swapfile space so that swapping can go to the swapfile,
and paging can go to the pagefile.  AUTOGEN is pretty good at calculating
the required sizes; unless you have some special knowledge about your system's
needs, follow its advice.  Note, however, that prior to V4.6 AUTOGEN doesn't
understand secondary page- and swapfiles.

	Also, given that our system never swaps or pages, does it matter (in
	terms of performance, I guess) that we don't have enough contiguous
	space for the secondary file (and have been creating it
	non-contiguously)?

The only effect non-contiguity would have is on the actual I/O rates, should
your system ever need to read or write the page or swapfile.  In your situa-
tion, it should make no difference (though there ARE some limitations on
how fragmented the primary page- and swapfiles can be.  These are difficult
to specify exactly, but these days it takes some effort to exceed the limits.
If at all possible, though, create your page- and swapfiles on a "clean" disk,
i.e., one recently compressed by a backup/restore sequence.)

			    W A R N I N G S

	If you have no dump file, VMS will write its dump into the pagefile.
	If, in addition, the SYSGEN parameter SAVEDUMP is 1, on the next
	reboot VMS will refuse to use any part of the pagefile occupied by
	the dump until you use ANALYZE/SYSTEM to release it.

	A common "gotcha'" when playing around with page- and swapfiles
	(and dump files, too):  NEVER, EVER delete a page-, swap- or dump
	file installed in the running system.  These files are accessed by
	levels of VMS below most of the I/O system, and are not locked.  If
	you delete them, VMS will continue to use the disk blocks that used
	to be allocated to them - writing over random stuff as those blocks
	get re-used.  The ONLY safe way to delete one of these files is to
	rename it to some innocent name - so that they won't get used at the
	next boot, then re-boot.

							-- Jerry
------