1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>What is virtual memory?</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux System Administrators Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Memory Management"
HREF="memory-management.html"><LINK
REL="PREVIOUS"
TITLE="Memory Management"
HREF="memory-management.html"><LINK
REL="NEXT"
TITLE="Creating a swap space"
HREF="swap-space.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux System Administrators Guide: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="memory-management.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 6. Memory Management</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="swap-space.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="VM-INTRO"
></A
>6.1. What is virtual memory?</H1
><P
>Linux supports <I
CLASS="GLOSSTERM"
>virtual memory</I
>, that
is, using a disk as an extension of RAM so that the effective
size of usable memory grows correspondingly. The kernel will
write the contents of a currently unused block of memory to the
hard disk so that the memory can be used for another purpose.
When the original contents are needed again, they are read back
into memory. This is all made completely transparent to the
user; programs running under Linux only see the larger amount of
memory available and don't notice that parts of them reside on
the disk from time to time. Of course, reading and writing the
hard disk is slower (on the order of a thousand times slower)
than using real memory, so the programs don't run as fast.
The part of the hard disk that is used as virtual memory is
called the <I
CLASS="GLOSSTERM"
>swap space</I
>.</P
><P
>Linux can use either a normal file in the filesystem or a
separate partition for swap space. A swap partition is
faster, but it is easier to change the size of a swap file
(there's no need to repartition the whole hard disk, and
possibly install everything from scratch). When you know how
much swap space you need, you should go for a swap partition,
but if you are uncertain, you can use a swap file first, use
the system for a while so that you can get a feel for how much
swap you need, and then make a swap partition when you're
confident about its size.</P
><P
>You should also know that Linux allows one to use several swap
partitions and/or swap files at the same time. This means
that if you only occasionally need an unusual amount of swap space,
you can set up an extra swap file at such times, instead of
keeping the whole amount allocated all the time.</P
><P
>A note on operating system terminology: computer science
usually distinguishes between swapping (writing the whole process
out to swap space) and paging (writing only fixed size parts,
usually a few kilobytes, at a time). Paging is usually more
efficient, and that's what Linux does, but traditional Linux
terminology talks about swapping anyway.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="memory-management.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="swap-space.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Memory Management</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="memory-management.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Creating a swap space</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|