Department of Computing | Imperial College |
Process management |
Linux is a multi-tasking, multi-user operating system. This means that lots of people can run lots of tasks (processes) on the same machine, at the same time. Problems can arise if processes are very computationally intensive, and hog the Central Processing Unit (CPU). If this happens, the CPU will be constantly busy, and the system will slow down. Luckily, most tasks tend to spend a lot of time waiting for other information, so this situation does not arise that often.
You should know which processes you are running, the load that these processes are placing on the system, how they can indirectly effect other users, and how to stop these processes.
The ps
command shows you the processes you are running:
sync01% ps x PID TTY STAT TIME COMMAND 12492 pb S 0:00 -tcsh 12559 pb R 0:00 ps xIn this case the user has only just logged in therefore the only processes running are the login shell (tcsh) and the command
ps
itself.
If we modify the ps
command it will show us not just our own
processes, but all processes run by all users including the system itself
(processes owned by 'root' or the system administrator):
sync01% ps aux | more USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND ard 12492 0.0 0.8 1748 1072 pb S 14:58 0:00 -tcsh bin 287 0.0 0.2 780 356 ? S 18:33 0:00 portmap cc5 11918 7.3 15.0 23776 19268 pa S 14:14 4:07 /usr/lib/netscape/net cc5 11928 0.0 2.0 12876 2636 pa S 14:14 0:00 (dns helper) daemon 265 0.0 0.3 800 444 ? S 18:33 0:00 /usr/sbin/atd ikz 11510 0.0 0.9 1800 1168 p8 S 13:51 0:00 -tcsh jmh2 11155 74.0 14.4 24752 18500 ? R 13:25 78:08 /usr/lib/netscape/net jmh2 11165 0.0 2.0 12876 2632 ? S 13:25 0:00 (dns helper) nu98 9476 0.0 0.9 1860 1224 p3 S 12:17 0:00 -csh nu98 10272 0.0 1.1 2176 1464 p4 T 12:51 0:00 perl timetable3.pl nu98 10454 0.0 0.7 1480 916 p3 S 12:58 0:00 vi timetable.pl root 1 0.0 0.3 796 436 ? S 18:33 0:03 init [5] root 2 0.0 0.0 0 0 ? SW 18:33 0:00 (kflushd) root 3 0.0 0.0 0 0 ? SW< 18:33 0:00 (kswapd) root 4 0.0 0.0 0 0 ? SW 18:33 0:00 (nfsiod)Note that this can be quite a long list and we have abbreviated it here. The output is 'piped' to the command 'more' to show it one screenful at a time - hit the space bar to continue.
See the Linux manual page on the ps
command for more information
on what the columns mean:
man psTo terminate a process you have started, type:
kill -9 pidwhere 'pid' is the number listed in the PID column. The
-9
flag
ensures that any protections the process may have are overridden by this
command.
top
, or
ps
to find out which processes are running on the system.
This is a list of commands which can be used to control processes.
kill
ps
nice
top
nohup
sleep
stty
).
fg
bg
jobs
limit
stop
© CSG / 2000 / help@doc.ic.ac.uk / |