What Is Process Management In Linux?

Linux Operating System

Linux was developed in the early 1990’s by Linus Torvald, a computer science student at the University of Helsinki. Linux performs well for most applications and is excellent as a network server, though it has yet proved its reliability in mission-critical applications like FreeBSD has.

Linux is distributed freely under GNU. Since Linux became a buzzword many organizations have started offering professional support and there are many sites on the Net where Linux questions are answered for free. Of course, if you are good at coding you can tweak the source code directly.

Linux is Multitasking and Multi-user Operating System. Linux distributions can be downloaded for free.


Process Management

The kernel considers each program running on our system to be a process. A process ‘lives’ as it executes with a lifetime that may be short or long. A process is said to die when it terminates. The kernel identifies each process by a number known as a process id or PID. A process has a user id(UID) and a group id(gid) which together specifies what permissions it has. A process has a parent process id (ppid) – the PID of the process that has created it.

Each process has its own working directory initially inherited from its parent process. There is an environment for each process. A collection of named environment variables and their associated values. The environment is usually inherited from the parent process.


Process Monitoring: ps

The ps command gives a idea of the processes running on the system at a given moment in time. It normally shows a brief summary of each process. The command ps has many options. Some of the most commonly used are:

  • -a – Show processes owned by other users
  • -f – display process ancestors in a tree-like format
  • -u – use the user output format, showing user names and process start times



Process Monitoring: pstree

 It also displays a snapshot of the currently running processes. It always uses a tree-like display similar to ps –f . Some of the most commonly used options for pstree are:

  • -a – displays command’s arguments
  • -c – don’t compact identical subtrees
  • -G – attempts to use terminal-specific line-drawing characters
  • -h – highlights the ancestors of the current process
  • -n – sort processes numerically by PID, rather than alphabetically by name
  • -p – includes PID in the output



Process Monitoring: top

The top command shows full-screen, continuously updated snapshots of process activity. It was for a short period of time between each snapshot to give the illusion of real-time monitoring. Processes are displayed in descending order of how much processor time they are using. It displays system uptime, load average, CPU status, and memory information. Some of the most commonly used options for the top are:

  • -b – Batch mode — send snapshots to standard output
  • -n num – Exit after displaying num snapshots
  • -d delay – Wait delay seconds between each snapshot
  • -i  – Ignore idle processes
  • –s  – Disable interactive commands which could be dangerous the superuser


Signaling Processes

 A process can be sent a signal by the kernel or by another process. Each signal is a very simple message: A small whole number with a mnemonic name. Signal names are all-capitals like INT. they are often written with SIG as part of the name for example: SIGINT. There are about 30 signals available not all of which are useful.

The following are the most commonly used signals:

Name Number Meaning
INT 2 Interrupt — stop running. Sent by the kernel when you press Ctrl+C in a terminal.
TERM 15 “Please terminate.” Used to ask a process to exit gracefully.
KILL 9 “Die!” Forces the process to stop running; it is given no opportunity to clean up after itself.
TSTP 18 Requests the process to stop itself temporarily. Sent by the kernel when you press Ctrl+Z in a terminal.
HUP 1 Hang up. Sent by the kernel when we log out or disconnect a modem. Conventionally used by many daemons as an instruction to re-read a configuration file.

Read Also: su & sudo COMMANDS IN LINUX

Sending Signals: kill

 The kill command is used to send a signal to a process It is a normal executable command, but many shells also provide it as a built-in. For example, to send a SIGHUP signal to a process we use either of the following two:

$ kill -HUP pid or

$ kill -s HUP pid

 If we omit out the signal name in the kill command, by default kill will send a SIGTERM  to the process. We can specify more than one PID to signal multiple processes at the same time.


In above kill command is using for PID 4242. It’s showing just the syntax.


Sending Signals to Daemons: pidof

On Linux/Unix systems, long-lived processes that provide some service are often referred to as daemons. Daemons typically have a configuration file (commonly under /etc) that affects their behavior. Many daemons read their configuration file only at startup. If the configuration changes, you have to explicitly tell the daemon by sending it a SIGHUP signal. We can sometimes use pidof to find the dæmon’s pid: for example, to tell the inetd dæmon to reload its configuration, we can run:

$ kill -HUP $(pidof firefox)



Process Priorities: nice

Not all tasks require the same amount of execution time. Linux has the concept of execution priority to deal with his. Process priority is dynamically altered by the kernel. We can view the current priority by looking at top or ps -l and looking at the PRI column. The priority can be biased using nice. The current bias can be seen in the NI column in the top.

The nice command starts a program with a given priority bias. Peculiar name: ‘nicer’ processes require fewer resources. Niceness ranges from +19 (very nice) to −20 (not very nice). Non-root users can only specify values from 1 to 19; the root user can specify the full range of values. Default niceness when using nice is 10.

To run a command at increased niceness (lower priority):

$ nice -10 long-running-command &

$ nice -n 10 long-running-command &

To run a command at decreased niceness (higher priority):

$ nice –15 important-command &

$ nice -n -15 important-command &

Modifying Priorities: renice

The command renice changes the niceness of existing processes. Non-root users are only permitted to increase a process’s niceness. To set the process with pid 2984 to a higher niceness (lower priority):

$ renice 15 2984

The niceness is just a number: no extra – sign. To set the process with pid 3598 to a lower niceness (higher priority):

$ renice -15 3598

You can also change the niceness of all a user’s processes:

$ renice 15 -u test


, , , , , , , , , , , ,

One Reply to “What Is Process Management In Linux?”

Leave a Reply