Click here for ObjectSpace: Business- to- Business Integration Company
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Chapter 22
System Monitoring: Keeping an Eye on Your System

In This Chapter

  Monitoring Memory
  Monitoring Processes
  Monitoring Your Disk
  Log Files

Many processes run on your system. In this chapter, you will get an overview on how you can monitor and control what your system is doing. For the most part, you won’t need to use any of these commands unless you suspect a problem or are trying to figure out how to fine-tune your system. Nevertheless, it’s very cool to know that you can look at different things to determine problems with performance or security, or just to keep an eye on what’s going on.

In terms of performance, Linux is fairly lean and mean as far as operating systems (OSs) go. In fact, it puts many other expensive OSs to shame. Although additional CPU speed will no doubt make your computer faster, additional RAM is likely to make more of an impact in terms of how fast you think things are happening. The single thing that can slow your computer the most is not having enough RAM for the programs you typically run at the same time. Linux makes do when it doesn’t have enough RAM by swapping.

Swapping copies data and programs currently in your computer’s memory (RAM) to disk is known as virtual memory. This makes room in the computer’s real memory (RAM) for another process to do whatever it needs to. When the swapped task needs to execute again, the Linux kernel puts it back in RAM, swapping out some other process. The amount of processes and tasks you can run depends on the amount of space you have assigned to your swap disk (virtual memory) and the amount of RAM you have installed. It is possible for you to run out of space on your swap disk, and at such a point, some programs will stop working. As you can tell, swapping doesn’t sound like something you want happening on your computer. Swapping can slow your computer to a crawl; you can tell when this is happening if you hear your hard disk thrashing (making noise all the time). The more RAM you have on your computer, the more programs you can run at the same time without swapping.

Monitoring Memory

There are several programs that can tell you what is going on with your computer’s memory.

How Much Memory: free

The simplest of these programs is called free. It displays how much memory you have available both in real RAM and as virtual memory, as in the following code:

     [alberto@digital alberto]$ free
                  total    used    free     shared   buffers     cached
     Mem:         38956    10196   28760     8468        836     5292
     -/+ buffers/cache:       4068      34888
     Swap:        39276          0      39276

Procinfo

Procinfo displays similar information as free, plus a bunch more. Information displayed by procinfo is collected by the kernel in the /proc directory. Here’s a screen dump of what is displayed by my lightly loaded Linux laptop:

  [alberto@digital alberto]$ procinfo
  Linux 2.0.33 (root@buildmeister.caldera.com) (gcc 2.7.2.3) #1  [digital]
  
  Memory:      Total    Used   Free    Shared   Buffers   Cached
  Mem:         38956    10316  28640     8540       836     5356

  Swap:        39276        0  39276
  Bootup: Sat Oct 03 09:46:52 1998 Load average: 0.00 0.01 0.00 2/32  544

  user  :       0:00:07.88   0.2%  page in : 5623  disk 1: 1563r 633w
  nice  :       0:00:00.00   0.0%  page out:      787
  system:       0:00:11.74   0.2%  swap in :        1
  idle  :       1:23:49.60  99.6%  swap out:        0
  uptime:       1:24:09.21         context :    31137

  irq  0:    504922 timer                 irq  8:         0
  irq  1:         2 keyboard              irq  9:         1
  irq  2:         0 cascade [4]           irq 10:         1
  irq  3:      1872 smc91c92_cs           irq 11:         1 i82365
  irq  4:         1                       irq 12:         0
  irq  5:         1                       irq 13:         1 math error
  irq  6:         2                       irq 14:     12829 ide0+
  irq  7:         1                       irq 15:         0

In addition to your current memory usage, it tells you when your system was last booted and its load average for the last 1, 5, and 15 minutes (0.00, 0.01, and 0.00). This information is followed by the number of runnable processes, total number of processes (2/32 on the listing), and the last process to run (544).

Next, procinfo displays information about the time the system has spent in user code, system code, or idle. Nice time is user code that is running with a lower priority. It also gives you the total time the machine has been up.

The next column displays information about virtual memory and disk activity. Page in and page out indicate amount of data that has moved in or out of a disk and into memory. One page is equal to 1K of data. Swap in and swap out indicate the number of pages swapped from disk to memory and from memory to disk. Context, as you can see in the preceding screen dump, is the number of context switches that have taken place. The disk column (it display more disks if you have more than one) will show the number of reads (1564r) and the number of writes (633w) since the system was booted.

This is followed by information on activity of devices connected to IRQ, such as keyboard or serial ports. Procinfo should also be able to display additional information on modules (kernel packages that are not loaded until needed) and activity for other devices if you supply the -a flag. At the time this book was written, the version of procinfo shipped with COL 1.3 was broken and didn’t display this information.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.