EmbLogic's Blog

PID, PPID and NICE value of a process

PCB (Process Control Board)
———————————-
Every Process has its Process Control Board(PCB) which tells about the process.
PCB contains PID,PPID,PC(program counter),nice value of process.
PID :-
* PID is Process Identification of any process.
* It is a number .
* Every Process has unique PID.
* It generally lies between 2 to 32768.
* 1 is reserved for init process (init starts at system boot & it controls other processeses).
* Obtaining PID of any process getpid() command is used-
#include<sys/types.h>
#include<unistd.h>
pid_t getpid(void);
PPID
* PPID is Parent Process Identification.
* It is also a number.
* Every process has unique PPID.
* It contains the PID of Process which creates this process(Parent Process).
* For Orphan Process PPID is generally 1 (init process).
* Obtaining PID of any process getppid() command is used-
#include<sys/types.h>
#include<unistd.h>
pid_t getppid(void);

NICE value
* OS determines Priority of a process using “nice” value.
* Default nice value is 0.
* Higher the “nice” value of a process, lesser will be  its priority.
* “nice” value of a process (say PROCESS_xyz having PID PID_xyz)can be increased using command -
nice PROCESS_xyz & –> Then it will allocate nice value to be +10.
* We can adjust “nice” value using -
renice 8 PID_xyz  –> It will adjust nice valueof PROCESS_xyz to be +8

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>