Process and States of Process

120

A program in execution is called a process. A process is more than just a text section of a program. A process also contains a process stack which includes temporary data, variables, functions, parameters, returns addresses, and a data section.

States of the process

Starting from the loading of the process, till execution, a process goes through many states. These are called the states of the process. The states of the process are discussed below –

processes in os
processes in os

New State – It is the state where the process is being created. That means the process is about to be created but not created. In this state, the process is in secondary memory.

Ready State – It is the state where the process is ready to be executed or waiting for its execution. The process in this state is loaded into the primary memory and waiting for its turn to be executed.

Running State – A process is in this state when its turn for execution comes and now the CPU  work on the process and the resources will be allocated to this process.

Block – A process enters into the waiting or block state when it is waiting for I/O devices. The process waits in memory and takes no use of the CPU.

Suspended Block – As we know that the primary memory is limited, and if there are many processes in the block state, some of the low-priority processes are sent to the suspended block state.

Terminated – When a process finishes its execution, it goes to the terminated state. Now, the resources allocated to the process are released by the CPU.

Process Control Block

The information contained by a process is stored in the process control block. A process control block contains information related to the process such as process state, process number, program counter, etc.

process control block
process control block

Process State – It stores the current state of the process such as ready, running, wait etc.

Program Counter – It is a pointer to the next executable instruction.

CPU Registers – These are the registers for various purposes. These include accumulators, index registers, stack pointers, condition conde info., etc.

CPU Scheduling Information – It stores information related to processing priority and all.

I/O Status Information – The information related to the input and output devices allocated to the process is stored here.

List of open files – This stores the list of files that are opened and under use by a process

So, we can say that a process control block stores all the information that differs from process to process.

So, in this article we learned about the concept of process, the various states a process goes through during its lifetime and the process control block which stores all the necessary information related to a process.

Previous QuizWhat is CPU : Components and Types of CPU?
Next QuizProcess Scheduling, Types of Schedulers, Context Switching in OS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.