Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site nsc.uucp
Path: utzoo!linus!philabs!seismo!hao!menlo70!nsc!lneff
From: lneff@nsc.UUCP
Newsgroups: net.micro.16k
Subject: Re: LMC Mega-foobar
Message-ID: <334@nsc.uucp>
Date: Thu, 21-Jul-83 13:13:49 EDT
Article-I.D.: nsc.334
Posted: Thu Jul 21 13:13:49 1983
Date-Received: Fri, 22-Jul-83 20:11:52 EDT
References: <413@sbcs.UUCP>, <464@mit-eddie.UUCP>
Organization: National Semiconductor, Sunnyvale
Lines: 38

GENIX -- National Semiconductor's port of 4.1 to NS16032-based hardware --
does not have a separate paging daemon process.  Because the
hardware architecture supplies and maintains a reference bit in our
page table entries, our page replacement algorithm is simpler than the
one on the VAX.  It is called by the kernel's page allocation routine
when physical memory runs out.  We keep a pointer into physical memory
and examine pages starting with that pointer.  We find the page table
entry that maps the page and check its reference bit.  If it's off,
then we stop and pick this page to page out.  Otherwise we turn off the
reference bit and go on to the next page.  If the page isn't referenced
by the time we cycle through memory, then we know it isn't in active
use and we pick it the next time around.  This is a simplified
explanation -- there are other factors involved in picking a page to
remove from memory, but the reference bit is the most important.

Once a page has been chosen, the disk I/O is started and the kernel
reschedules.  When the I/O is completed, the disk interrupt routine
does some cleanup and wakes up the process that needed the memory.
Freed but dirty pages are zeroed in the kernel's idle loop.

When the paging rate is high or free memory has been low for several
seconds, then the schedular/swapping process frees a number of pages at
once by swapping out an unused shared text or a process.  The schedular
and swapping algorithms are similar to the 4.1 code, except we always
try to swap unused shared texts before we swap processes, and we made
changes to allow a process to be "partially swapped" if the memory
situation warrants it.  To "swap" a GENIX process, we step through the
process's level 2 page tables and page out every memory page. Then we
step through the level 1 page table and page out every level 2 page
table.

Laura Neff
National Semiconductor Corporation
!menlo70!nsc!lneff

GENIX is a trademark of National Semiconductor Corporation.