0
3.4kviews
Write a note on process management in Linux along with relevant command for process management.

Mumbai University > Information Technology > Sem 5 > Open Source Technology

Marks: 5M

Year: Dec 2015

1 Answer
1
28views

Every command that you start from the shell can be managed as a job. There are, however, many more tasks that are running at any given moment on Linux Server. These tasks are referred to as processes.

Every job that starts is not only a job but also a process. In addition, when a server boots , many other processes are started to provide services on server. These are the daemons, which are processes that are always started in the background and provide services on your server.

Managing processes is an important task for a system administrator. One may need to send a specific signal to a process that doesn’t respond properly anymore. Otherwise, on a very busy system, it is important to get an overview of the system and check exactly what it is doing. We can use few commands to manage and monitor processes on system, as shown in Table:

enter image description here

ps command:

As an administrator, you might need to find out what a specific process is doing on your server. The ps command helps you do that.

If run as root with the appropriate options, ps shows information about the current status of processes. For historical reasons, the ps command can be used in two different modes: the BSD mode, in which options are not preceded by a – (minus) sign, and the System V mode, in which all options are preceded by a – (minus) sign. Between these two modes, there are options with overlapping functionality. Two of the most useful ways to use the ps commands are in the command:

  • ps afx, which yields a treelike overview of all current processes, and
  • ps aux, which provides an overview with a lot of usage information for every process.

Kill command:

To send signals to processes, you will use the kill command. This command typically has two arguments. The fi rst argument is the number of the signal you want to send to the process, and the second argument is the PID of the process to which you want to send a signal. For instance, the command kill -9 1234 will send the SIGKILL signal to the process with PID 1234.

When using the kill command, you can use the PIDs of multiple processes to send specifi c signals to multiple processes simultaneously. Another convenient way to send a signal to multiple processes simultaneously is by using the killall command, which takes the name of a process as its argument. For example, the command killall -SIGTERM hpptd would send the SIGTERM signal to all active httpd processes.

Top command:

The top program offers a convenient interface in which you can monitor current process activity and also perform some basic management tasks. Top command gives us a user interface window through which we can manage processes. The topmost part of this user interface shows the current system activity. The lower part of the top window shows a list of the most active processes at the moment. This window is refreshed every fi ve seconds. If you notice that a process is very busy, you can press the k key from within the top interface to terminate that process. The top program will fi rst ask for the PID of the process to which you want to send a signal (PID to kill). After you enter this, it will ask which signal you want to send to that PID, and then it will immediately operate on the requested PID.

Pstree command:

If you run a command from a shell, the command becomes the child process of the shell. pstree command helps us to see that commands are run as a subshell.

Please log in to add an answer.