Mailinglist Archive: opensuse (2700 mails)

< Previous Next >
Re: [SLE] swap space question in 9.3 install
  • From: Jerry Feldman <gaf@xxxxxxx>
  • Date: Thu, 28 Jul 2005 09:09:28 -0400
  • Message-id: <200507280909.28825.gaf@xxxxxxx>
On Thursday 28 July 2005 8:28 am, Ken Schneider wrote:
> I was first exposed to unix (SUN OS) in 1987 and (as far as I can
> remember) I was told that swap was generally 2X the amount of memory.
> SUN OS was clearly around before windows was. Windows 1.0 was released
> in 1985.
It certainly was. Sun was founded in 1982. The X Window System was developed
in the mid-1980s. I think that Apple released the Mac in the 1984 time
frame, but the Lisa predated the Mac.

In any case, early Unix systems did not contain virtual memory, but used a
technique called swapping, hence the term. Virtual memory for Unix systems
started to appear in the early 1980s. before virtual memory, entire
processes were swapped out.
Today, Linux (and other Unix systems) use modern demand paged virtual memory
where the system is broken down into a series of pages. The page size is a
function of both the OS and the hardware. Today, when you run a program (in
very general terms):
The text section (eg. the instructions) are mapped read-only into your
virtual memory from where the program resides. Those pages are not
necessarily paged in at the start. The text pages may be shared by multiple
instances of that program.
Your initialized data is also mapped in, but those pages may be written to.
If need be, those pages can be swapped out to the swap area.
You .bss section (unititialized data) is also mapped, but the pages are not
created until they are used.
Most Linux programs also use shared libraries. These libraries are also
mapped to the process' virtual memory, and swapped in as required. These
pages are also shared by processes who use them.

The bottom line is that virtual memory makes a very efficient use of
physical memory. When the system starts to run short of physical memory,
the first type of pages to be reused are those read-only pages because they
do not have to be copied to the swap area.
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9

< Previous Next >