swap and tempfs
Gene Collins
collins at gene3.ait.iastate.edu
Mon May 17 11:21:54 EDT 2004
Hello all. I've lost Cheryl's original message, but here are a couple
of thoughts about swap and tempfs.
Tempfs has nothing do do with swap space. It is a temporary ram based
file system which can have parts of it's allocated memory swapped out to
swap space if necessary. It is like a ram disk, but you don't need to
make a file system for it, and it will dynamicly add or free memory,
depending on what is stored on the tempfs file system. It will use up
to a maximum of 1 half of whatever amount of ram you have installed in
the machine. So if you have 256 meg of ram, the maximum amount of ram
the tempfs file system will use is 128 meg. If you have 512 meg of ram,
the maximum ram usage will jump to 256 meg, etc. The upshot of this is
that you use tempfs anywhere that you would normally use a ram disk. It
can be mounted where ever you would like a dynamicly sized ram disk to
be mounted. You could, for example, mount it on /tmp, and all your
temporary files such as the ones created by lynx the cat would be
created on the ram disk, instead of on your hard disk. This means that
the file access for these files will be faster, since it takes place in
ram, but the trade off is the ram disk, in this case tempfs, has a
maximum size, which means you could run out of temporary file space.
Look at the kernel help for tempfs for more info about tempfs and how to
mount it.
Swap space on the other hand is overflow space for data or applications
that aren't active. It is the equivalent of the Windows virtual memory
that most of you are familiar with. When your system starts, no swap
space will be used, because all the processes will be in active memory.
As other processes get started and stopped, inactive or low priority
applications and data memory pages can be swapped out to the disk swap
space. When memory becomes available, or the need arises to execute an
application that has been swapped, or to read or write data pages that
have been swapped, other applications or dat are written to swap and the
needed swap pages are read back in to ram. The more actual ram you have
installed in the system, the longer it will take before it becomes
necessary to use swap space. Thus, the longer the system has been
running, the more likely it is that swap space will be used. Unlike
windows, it is not necessary to assign a two to one ratio of swap space
to ram, a one to one ratio is sufficient. Thus, if you have 256 meg of
ram, then a 256 meg swap space is a good idea, and not the 512 meg of
swap that Windows would want.
Have a nice day.
Gene
More information about the Speakup
mailing list