Документ взят из кэша поисковой машины. Адрес оригинального документа : http://star.arm.ac.uk/sag-0.4/node60.html
Дата изменения: Sun May 4 15:24:37 1997
Дата индексирования: Mon Oct 1 22:46:24 2012
Кодировка:

Поисковые слова: m 13
What is virtual memory? next up previous contents index
Next: Creating a swap space Up: Memory Management Previous: Memory Management

What is virtual memory?

Linux supports virtual memory, 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 swap space.

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.

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.


next up previous contents index
Next: Creating a swap space Up: Memory Management Previous: Memory Management

Lars Wirzenius
Sun May 4 14:08:43 EEST 1997