Introduction to Processes

Introduction to process

————————–

What is a process?

———————

.Each running application is called a process.

.Each process are identified by a no. called preocess idification no. (PID)

.PID of ‘init” process is always 1.

init= it is the first process that is started at boot time.,

it is called also grand parent of all the process

* Types of process

———————–

I. foreground process

II. backgroup process

States of process

——————

Runnable – R

Sleeping – S

Stopped –  T

uninterruptiable sleep -D

Zombie (defunct) – Z

Additional states

——————–

Process with high priority – <

,,       ,,  low   ,,      – N

,,       ,,  having pages locked into memory – L

,,      ,,   np resident pages into memory – W

Note using #pstree (displays process ancestory)

Viewing process states

#ps (displays all the process that are running in the foreground under the control of current terminal

#ps -A (all the terminal

#ps -x (displays all the background prcoess

#ps -l ( ,,     long listing of processs)

#ps -u (,,    user owner of the process)

#top – (text based process monitoring tool)

PRI= System priority

NI = Nice value (user managed priority)

Altering process scheduling priority

—————————————

Max priority (Nice value) –> -20

Min  ,,          ,,        ,, +19

default ,,      ,,        ,,  0

nice – used to set priority of an application when it is run.

renice – used to after priority of a runing application(process).

#renice -5 -P 1

-5=priority(nice value)

-P=option to specify pid

1=pid of process

Introduction to process (contd…)

Sending signals to process

—————————-

kill                               [signal]                       [pid]

-15      –>                   Soft signal (default signal. als                                                                   o used while processing CTRL+C

[-TERM]

-9

[-kill]    –>                   Strong signal

Killall                          [signal]                       [application_name]

-15                              to kill the application form all                                                                     the terminal

-9

Running process into background

———————————

#find / -name httpd.conf >httpdout & (running process in backgroud and print output in httpdout

#find / -name httpd.conf >httpdout 2>httderr &

#jobs – Displays the status of all the background & stopped jobs.

* Stopping a process

#find / -name *.conf

use CTRL+Z to pause the current job (process)

* Resuming stopped process

—————————-

#bg %job_id – to resume the stopped process into background

#fg %job_id – to resume the stopped prcoesss into foreground

#kill %job_id – to kill the stopped process