Thursday 25 February 2016

PROCESS MANAGEMENT IN OPERATING SYSTEMS


The main use of operating systems is to execute programs. But in multiprogramming environment more than one programs need to be executed. However, since we have limited CPU’s(generally one), only a set of programs are actually using the cpu at a particular time.

Therefore, we have programs which are ready to be executed and which are currently using cpu or running.

Therefore, to distinguish between such programs we have states.

Also note, that whether a program is running or is ready to run it is kept in main memory or RAM as fetching programs again and again from disk upon state change will be very costly.

What is a process?


Def: A process is a program which is residing in the main memory or RAM.

Now, since we may have many processes in the main memory we will need to distinguish between them. For this purpose we have a special data structure associated with every process. It is called Process Control Block or PCB

What is PCB?


A PCB essentially contains following information:

·       Process ID
o   It is a unique identifying number assigned by OS during process creation
·       Process State
o   Contains the current state info for the process
·       Program Counter
o   Contains the address of the next instruction to be executed in the process
·       Priority
o   Parameter assigned by the process during process creation. Representation of how important a process is wrt other processes
·       General Purpose registers
·       List of open files
·       List of open devices
·       Security and protection information


Various states of a process are:






·       

      New
o   The process is under creation , and when the process is created it moves to the ready state
·       Ready
o   In ready state, there are a number of processes, out of which one is selected to e executed
·       Running
o   In this state the CPU executes the instruction of the running process. Only one process can be in running state for a single processor system.
·       Wait(for I/P or some other event)
o   When process performs I/O operation, the process moves to this state.
·       Completed
o   When the process has reached the end and no more requires any resource
·       Suspend ready
·       Suspend wait


Following operations are performed on process:

·       Process creation
·       Process scheduling
·       Process execution
·       Termination/Completion

No comments:

Post a Comment