Free web servers - CHAPTER 16 TAKING CONTROL OF THE SYSTEM

CHAPTER 16 TAKING CONTROL OF THE SYSTEM it created in order to run. The main process is called the parent, and the ones it creates are referred to as child processes. Tip You can see a nice graphical display of which parent owns which child process by typing pstree at the command-line shell. While this should mean your system runs smoothly, badly behaved programs sometimes don t go away. They stick around in the process list. Alternatively, you might find that a program crashes and so isn t able to terminate itself. In very rare cases, some programs that appear otherwise healthy might get carried away and start consuming a lot of system resources. You can tell when this happens because your system will start slowing down for no reason, as less and less memory and/or CPU time is available to run actual programs. In all of these cases, the user usually must kill the process in order to terminate it manually. This is easily done using top. The first task is to track down the crashed or otherwise problematic process. In top, look for a process that matches the name of the program, as shown in Figure 16-2. For example, the Firefox web browser generally runs as a process called firefox-bin. Figure 16-2. You can normally identify a program by its name in the process list. Caution You should be absolutely sure that you know the correct process before killing it. If you get it wrong, you could cause other programs to stop running. Because top doesn t show every single process on its screen, tracking down the trouble- causing process can be difficult. A handy tip is to make top show only the processes created by the user you re logged in under. This will remove the background processes started by root. You can do this within top by typing u, and then entering your username. Once you ve spotted the crashed process, make a note of its PID number, which will be at the very left of its entry in the list. Then type k. You ll be asked to enter the PID number. Enter that number, and then press Enter once again (this will accept the default signal value of 15, which will tell the program to terminate).

Leave a Reply