Register for EarthWeb's Million Dollar Sweepstakes!
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


Monitoring Processes

Your system is continuously running processes. To get an idea of what is going on with your system, there are a number of programs that you can use.

Listing the Current Top Processes: top

Top gives you a real-time look into what your computer is doing. After you start it up, it will refresh once per second, displaying information about the principal processes on the computer.

Here’s a sample screen:

  20:33:53 up  2:05,  2 users,  load average: 0.17, 0.07, 0.02
  35 processes: 34 sleeping, 1 running, 0 zombie, 0 stopped
  CPU states:  4.6% user,  6.9% system,  0.0% nice, 88.6% idle
  Mem:   38956K av,  12376K used,  26580K free,  10640K shrd,  1156K  buff
  Swap:  39276K av,      0K used,  39276K free         5908K  cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME  COMMAND
  655 alberto   20   0   612  612   452 S       0  9.7  1.5   0:10  top
  656 root       8   0   592  592   436 R       0  1.7  1.5   0:00  top
    1 root       0   0   340  340   268 S       0  0.0  0.8   0:02  init
    2 root       0   0     0    0     0 SW      0  0.0  0.0   0:00  kflushd
    3 root     -12 -12     0    0     0 SW<     0  0.0  0.0   0:00  kswapd
  444 alberto    0   0   696  696   404 S       0  0.0  1.7   0:00  login
  363 root       0   0   344  344   272 S       0  0.0  0.8   0:00  getty
  177 root       0   0   304  304   240 S       0  0.0  0.7   0:00
   rpc.rstatd
   19 root       0   0     0    0     0 SW      0  0.0  0.0   0:00  nfsiod
   20 root       0   0     0    0     0 SW      0  0.0  0.0   0:00  nfsiod
   21 root       0   0     0    0     0 SW      0  0.0  0.0   0:00  nfsiod
   22 root       0   0     0    0     0 SW      0  0.0  0.0   0:00  nfsiod
  107 root       0   0   328  328   260 S       0  0.0  0.8   0:00  inetd
   57 root       0   0   260  260   208 S       0  0.0  0.6   0:00  update
  109 bin        0   0   312  312   244 S       0  0.0  0.8   0:00
   rpc.portmap
  116 root       0   0   356  356   276 S       0  0.0  0.9   0:00  syslogd
  119 root       0   0   476  476   276 S       0  0.0  1.2   0:00  klogd

At the beginning of the listing, top displays general information about the system. The first line displays the current time, amount of time the system has been up, number of users, and load average for the last 1, 5, and 15 minutes.

The second line displays the total number of processes running in the system and what they are doing: sleeping processes, those that are not currently doing anything; zombie processes, those that are processes that should be dead but for some reason are still around; and stopped processes.

The third line displays the various CPU states, such as how much time your computer has spent executing user or system code, or nice time. Nice time represents time spent by processes that are executing with a lower priority. These processes are represented by a positive priority because they are nice to other processes (typical priority is 0). Negative priority processes are allocated more CPU so they have a higher priority and get additional chances to run.

On the fourth and fifth lines, you see information regarding real and virtual memory. Virtual memory is the one that uses the swap disk to accommodate more processes than you can run given your RAM.

Following the general information area is a listing of all the main processes, including the ID for the process (PID) owner and priority and resource consumption for CPU and memory.

When top is running, there are a number of options you can specify to customize the information it displays. Some of the more useful are shown in Table 22.1.

Table 22.1 Top Options

Interactive Commands Description

Space Updates display
Ctrl+L Redraws the screen
? Prints help
i Toggles display of idle processes
c Toggles display of command name/line
l Toggles display of load average
m Toggles display of memory information
t Toggles display of summary information
k Kills a task (with any signal)
r “Renices” a task (change its current priority)
P Sorts by CPU usage
M Sorts by resident memory usage
T Sorts by time/cumulative time
n Sets the number of processes to show
s Sets refresh rate
q Quits


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.