Killing Runaway Processes

This is a step-by-step guide to cleaning up runaway processes for computer novices. If you are reading this, you probably followed a link from one of my introductory web pages.

Sometimes computer programs get out of control and start using up all the machine's CPU time, slowing the computer down for everyone else who's trying to use it. This most often happens when firefox or acroread (Acrobat Reader) crashes.

You can check whether you have any runaway processes by typing "top", which which will give you a regularly updated display of the processes, beginning with the ones using the most CPU. Press "q" to exit top. Here is an example of the output from the "top" command:

top - 14:56:44 up 4 days,  2:33,  3 users,  load average: 0.04, 0.04, 0.01
Tasks: 127 total,   1 running, 126 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.5% us,  0.3% sy,  0.0% ni, 99.2% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   2056828k total,  1768856k used,   287972k free,   267712k buffers
Swap:  2031608k total,        0k used,  2031608k free,   960008k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4909 root      15   0  168m  36m 5936 S    1  1.8  10:31.86 X
16106 eva       15   0 35920  13m 8472 S    0  0.7   0:00.64 gnome-terminal
    1 root      16   0  2524  552  472 S    0  0.0   0:00.70 init
    2 root      RT   0     0    0    0 S    0  0.0   0:00.08 migration/0
    3 root      34  19     0    0    0 S    0  0.0   0:00.04 ksoftirqd/0
    4 root      RT   0     0    0    0 S    0  0.0   0:00.02 migration/1
    5 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1
    6 root       5 -10     0    0    0 S    0  0.0   0:00.38 events/0
    7 root       5 -10     0    0    0 S    0  0.0   0:00.32 events/1
    8 root       6 -10     0    0    0 S    0  0.0   0:00.00 khelper
    9 root      15 -10     0    0    0 S    0  0.0   0:00.00 kacpid
   46 root       5 -10     0    0    0 S    0  0.0   0:00.00 kblockd/0
   47 root       5 -10     0    0    0 S    0  0.0   0:00.00 kblockd/1
   48 root      15   0     0    0    0 S    0  0.0   0:00.00 khubd
   65 root      20   0     0    0    0 S    0  0.0   0:00.00 pdflush
   66 root      15   0     0    0    0 S    0  0.0   0:00.64 pdflush
   67 root      25   0     0    0    0 S    0  0.0   0:00.00 kswapd0

On this machine, nothing is using very much CPU. You can tell this from the line where it says ``99.2% idle'', or from the very low numbers in the ``%CPU'' column.

If you see any runaway processes of yours at the top of the list and eating lots of CPU, you can get rid of them by typing ``kill PID'', without the quotation marks and replacing ``PID'' by the number in the first column. You may need to repeat the kill command or use ``kill -9 PID'', which is a more emphatic kill and should work even on processes which are too mixed up to respond to ``kill PID''. You won't be able to kill other people's processes by accident.

If it is your web browser which ran away, then you may need to locate and remove any leftover ``lock'' files before the browser will start working again. Search the .mozilla directory for files with ``lock'' in their name.