Linux

Linux Process

Process defined as: "A process is program (command given by user) to perform specific Job. In Linux when you start process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535."

Process types

There are different types of processes, one by one we will study them.

Interactive processes

Interactive process can run in the foreground as well as in background. These process are started and controlled through the terminal. If your process is initialized by terminal and running in foreground, then you can not give new command to the terminal. Consider if you open gedit by terminal. while the gedit is running, you can not give new command to that terminal. If you want to give new command to terminal, then process must be running in background. In order to run command in background use & at end of command, like

# gedit &

Automatic processes

Automatic or batch processes are not connected to a terminal. Rather, these are tasks that can be queued into a spooler area, where they wait to be executed on a FIFO (first−in, first−out) basis.

Daemons

Daemons are server processes that run continuously have no graphical interface. example httpd, vsftpd, mysqld etc. The "d" outside the process defines that it is daemons process.

Process attributes

A process has a series of characteristics:
  • The process ID or PID: a unique identification number used to indicate the process.
  • The parent process ID or PPID: the number of the process that started this process.
  • Terminal or TTY: terminal to which the process is connected.

Linux Command Related with Process

Let us discuss some useful command related to process.

ps

To see currently running process
Linux running process
Showing running process

ps -ag

To get information about all running process
Linux running process
Showing running process

top

To see currently running processes and other information like memory and CPU usage with real time updates.
Linux running process
Showing running process

pstree

To display a tree of processes.
Linux process tree
Process tree

pidof

To know the process id of process Implementation.
Linux process id
Process id

kill 0

To stop all process except your shell.
# kill 0

kill PID

To stop any process by PID. To stop any process by PID i.e. to kill process.
#kill 34

killall {Process-name}

To stop processes by name i.e. to kill process.
# killall httpd

Ctrl+C Stop a process running in the foreground.






admin