Merge branch 'vendor/BINUTILS225'
[dragonfly.git] / share / doc / papers / newvm / 0.t
1 .\" Copyright (c) 1986 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)0.t 5.1 (Berkeley) 4/16/91
29 .\"
30 .rm CM
31 .TL
32 A New Virtual Memory Implementation for Berkeley
33 .UX
34 .AU
35 Marshall Kirk McKusick
36 Michael J. Karels
37 .AI
38 Computer Systems Research Group
39 Computer Science Division
40 Department of Electrical Engineering and Computer Science
41 University of California, Berkeley
42 Berkeley, California  94720
43 .AB
44 With the cost per byte of memory approaching that of the cost per byte
45 for disks, and with file systems increasingly distant from the host
46 machines, a new approach to the implementation of virtual memory is
47 necessary. Rather than preallocating swap space which limits the
48 maximum virtual memory that can be supported to the size of the swap
49 area, the system should support virtual memory up to the sum of the
50 sizes of physical memory plus swap space. For systems with a local swap
51 disk, but remote file systems, it may be useful to use some of the memory
52 to keep track of the contents of the swap space to avoid multiple fetches
53 of the same data from the file system.
54 .PP
55 The new implementation should also add new functionality.  Processes
56 should be allowed to have large sparse address spaces, to map files
57 into their address spaces, to map device memory into their address
58 spaces, and to share memory with other processes. The shared address
59 space may either be obtained by mapping a file into (possibly
60 different) parts of their address space, or by arranging to share
61 ``anonymous memory'' (that is, memory that is zero fill on demand, and
62 whose contents are lost when the last process unmaps the memory) with
63 another process as is done in System V.
64 .PP
65 One use of shared memory is to provide a high-speed
66 Inter-Process Communication (IPC) mechanism between two or more
67 cooperating processes. To insure the integrity of data structures
68 in a shared region, processes must be able to use semaphores to
69 coordinate their access to these shared structures. In System V,
70 these semaphores are provided as a set of system calls. Unfortunately,
71 the use of system calls reduces the throughput of the shared memory
72 IPC to that of existing IPC mechanisms.  We are proposing a scheme
73 that places the semaphores in the shared memory segment, so that
74 machines that have a test-and-set instruction can handle the usual
75 uncontested lock and unlock without doing a system call. Only in
76 the unusual case of trying to lock an already-locked lock or in
77 releasing a wanted lock will a system call be required.  The
78 interface will allow a user-level implementation of the System V
79 semaphore interface on most machines with a much lower runtime cost.
80 .AE
81 .LP
82 .bp