Operating System Processes
Operating System Processes: A Process can be defined as an entity which represents elementary unit of work to be implemented in the system. A process is basically a program in execution, the execution is done in sequential fashion. Process and program are two different entities program is a static entity while process is a dynamic entity whether a program cannot perform any activity by itself.
Components of process
A program has following main components:
- Object program
It is a piece of code to be execute
It is used for program execution
Some resources are required for program execution
It verifies the status of process execution. a process can be complete only when all the requested resources are allocated to that process
Process changes it stats during its execution, the state of a process is generally a current activity of the process. Process basically have five following stats
The state is new when the process is created.
When the process is waiting to be assigned to a processor. Ready is a state after creation of a process when it waits for allocation of CPU for it running.
The process is in running state when CPU is allocated to the process and it starts its execution. The process is currently being executed is called as running state of process.
When the process waits for occurrence of some event such as the completion of an I/O operation.
When the process has finished its execution this state is called as termination state.
PCB, Process Control Block
A process in operating system is represented by PCB which is called as process control block. Operating system use PCB as a data structure. PCB contains CPU scheduling, file management information, I/O resource management etc. it assists as the repository for all kind of information which can vary form process to process. When the process created then loader/linker sets flags and registers. If the process gets deferred, then the content of registers is kept on a stake and pointer to the specific stack frame is stored in the PCB. Using this technique, the state of hardware can be reinstated so that the process can be schedule to run again. PCB contain all the information about process which are given as
|Pointer||It is using for maintaining the scheduling information. Pointer points to another PCB in the list.|
|Process state||It define the state of process such as new, ready, running, waiting and termination.|
|Program counter||It indicates the next instruction of the process which have to execute|
|CPU register||It includes different general purpose registers of CPU such as index registers, accumulators and so on. The type and numbers of the registers totally depends on the architecture of computer.|
|Memory management information||It may include the information about value of base and limit registers, the segment table, the page table depending upon the memory system used by the operating system. This information is required for deallocation of the memory when the process terminates.|
|Accounting information||Accounting information keep the amount of CPU and real time used, job or process number, time limits, account number and so on.|