Lecture 8.
Introduction to Linux Process
Management
A process means program in execution. It generally takes an input, processes it
and gives us the appropriate output.
Types of processes in Linux
There are basically 2 types of processes.
1. Foreground processes: Such kind of processes are also known as interactive processes. These are the
processes which are to be executed or initiated by the user or the programmer, they can not be initialized by
system services. Such processes take input from the user and return the output. While these processes are
running we can not directly initiate a new process from the same terminal.
2. Background processes: Such kind of processes are also known as non interactive processes. These are the
processes that are to be executed or initiated by the system itself or by users, though they can even be
managed by users. These processes have a unique PID or process if assigned to them and we can initiate other
processes within the same terminal from which they are initiated. The background process will be in stop
state till input from the keyboard is given (usually ‘Enter’ key) then becomes a foreground process
and gets executed. Only after the background process becomes a foreground process, that process
gets completed else it will be a stop state.
Basic commands used for process management in Linux
Process status(ps): displays all
the process in execution
To list all process in the
background using ‘ps –f’ and to
know more info on process use
‘ps -ef’
● First column: User Id
● Second column: PID (process Id) – this is the 5-digit number assigned by OS for a process. No PID can be the
same.
● Third column: PPID (parent process Id) – PID of the parent process
● Fourth column: CPU utilization of process
● Fifth column: STIME – Process start time
● Sixth column: TTY – the Terminal type associated with the process
● Seventh column: CMD – the command that started that process
● kill: Used to a process whose PID is known. To kill a process forcefully and unconditionally use
● “kill -9 PID”
● bg: A job control command that resumes suspended jobs while keeping them running in the background
● fg: It continues a stopped job by running it in the foreground
There are five types of Process in Linux
1. Parent process: The process created by the user on the terminal. All processes have a parent process, If it
was created directly by user then the parent process will be the kernel process.
2. Child process: The process created by another process (by its parent process). All child processes have a
parent process.
The example is given above, the process having PID 28500(last row) is a child process of the process having
PID 26544.
3. Orphan process: Sometimes when the parent gets executed before its own child process then the child
process becomes an orphan process. The orphan process have “Init” process (PID 0) as their PPID (parent
process ID)
4. Zombie process: The processes which are already dead but shows up in process status is called Zombie
process. Zombie processes have Zero CPU consumption.
5. Daemon process: These are system-related processes that run in the background. A Daemon process can
be recognized if it has “?” in its TTY field (6th column)
Managing running processes
The [ps] command is the command used to manage running processes and can be
used for many things including viewing the status of your computer and getting a
quick idea of how well the computer is performing.
Here are some common ps commands.
Command, Usefulness
ps View current interactive processes on this terminal.
ps –a All current processes on this terminal, by all users.
ps –x All processes not assigned to a terminal (daemons).
ps –aux Output all process running and include resource utilization information.
The man page for ps contains extensive documentation on how to modify and
interpret the output of ps.
Top is a utility that can be used to display a live dataset of the currently running
processes. Activate it by typing [top].
Thank you for your attention!