Can I minimize expansion swaps?

John F. Haugh II jfh at rpp386.cactus.org
Thu Oct 25 22:51:43 AEST 1990


In article <1990Oct24.215412.5192 at gtisqr.uucp> roger at gtisqr.uucp (Roger Droz) writes:
>I have two programs that run well at work on a system V with paged
>virtual memory and run poorly at home on a system 3 derived Xenix with
>swapping style virtual memory.  I believe the performance difference to
>be related to "expansion swaps", where Xenix must write the whole data
>segment of the process to the swap device whenever the process size must
>be increased by an mmu increment. (4K on my Tandy 6000.)

The system will only swap a process while growing the data segment
if there is insufficient physical memory to hold the new process
free at the moment.  A request is made for a memory region large
enough to hold the new data segment, and if it fails, the process
is swapped out until malloc is able to satisfy the request.

The problem is that the code does not check for adjacent physical
pages, so the only option is swap, and since the Tandy 6000 only
supports 1MB or so of physical memory, running out is easy.

malloc()'ing the memory in advance will give you one big swap.
The only thing is to do it close to where the memory is needed so
you don't have all that physical memory tied up and force other
processes to swap.

This same trick works with streaming tape drivers which require
large amounts of physical memory for buffering.  Write a command
which does a giant malloc, fondles all the pages, and then exits.
Now, restart your streaming tape application and it should work
just fine.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"SCCS, the source motel!  Programs check in and never check out!"
		-- Ken Thompson



More information about the Comp.unix.internals mailing list