BSD virtual memory mngmt algorithm. Was: Performance Tuning Ultrix 4.1

Dennis Ferguson dennis at gpu.utcs.utoronto.ca
Sun May 12 08:43:43 AEST 1991


In article <13087 at dog.ee.lbl.gov> torek at elf.ee.lbl.gov (Chris Torek) writes:
>In article <16121 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>>Other than Sun, almost all ports of 4.nBSD have had to overhaul the
>>virtual memory code, which was written quite narrowly for a VAX-like
>>VM system.  (Sun simply BUILT a VAX-like VM system!)
>
>Well no: while the old VM was rather icky and somewhat painful to
>modify for 3-level schemes such as the i386 and 68030, it did work
>pretty well for anything that had hardware PTEs.
>
>Sun did not build a VAX-like VM system, if by `system' you mean `MMU';
>the Sun MMU is much more like a TLB.  What they did, rather, was make
>software PTEs that simulated a VAX.

The IBM RT, with its inverted page tables, was another one for which
the port of 4.x BSD was done by implementing VAX-like PTEs in software.
As efficient text sharing had to be implemented by moving the data up
into a different (256 Mb) segment from the text, the macros for converting
from VAX-style PTEs, where the data PTEs are contiguous with text, to
memory addresses and back became extremely ugly.

While functional, the end result was pretty disgusting.

>The current BSD development systems have a Mach-based VM (with a few,
>ah, `interesting' bugs) which is scheduled to change rather a lot over
>the next few months....

One merit of the old BSD VM with respect to the RT (if lack of function
can be called a "merit") is that it didn't try to do anything fancy.
Inverted page tables really suck for implementing things like copy-on-write
forks, and are pretty awful for sharing memory in general unless you can
arrange it so that shared objects are usually kept segment-aligned.  The
RT (and the RS/6000, which inherited the same memory management) probably
makes a pretty good test case for the generality of a "portable" VM subsystem
since its MMU is quite unconventional.

Dennis Ferguson
University of Toronto



More information about the Comp.unix.wizards mailing list