Saturday, November 03, 2001

Memory Status

Processes use memory (RAM) to run. Actually, most Linux computers have two types of memory: RAM and swap space (okay, hard disk and other storage devices are also consider memory, but let’s use this term for things that get erased when you put off the computer). The RAM comes with the computer system as a set of chips that store data as long as the machine is powered. Its access time is much faster than hard disk’s access time, and programs are loaded into memory by the Operating System for execution. Since RAM might not be enough, Linux has one part of the hard disk known as swap space that acts like an extra RAM, though a little slower.

If you want to know how much RAM and swap space is available and used in your machine, type free. The output of this command depends of course on what is running in the system: more processes means less memory free.

Another command related to memory usage is memstat, which tells you what files/processes are using memory, how much and the process number. One possible way of using this command is as this example:


memstat | sort -n

This will sort out the output by the memory usage, so you get the processes using more memory at the end of your output, which can be useful to identify processes that consume resources.

No comments: