What is Process in OS?

Process Scheduling in OS, Process States in Linux
Process State Diagram

Today's topic is Process. The process is an important topic in the operating system. Any program you run in your computer is the process at the time of execution.

There are many processes are running in the background when you are working on your computer. To understand that how the process works in an operating system be with us in this article.


Practice MCQ Questions on SabQuiz

Practice Now


What is Process in OS?

A process is a program at the time of execution. The process is more than the program code. It includes the program counter, the process stack, and the content of the process register, etc.

The purpose of the process stack is to store temporary data, such as subroutine parameters, return address and temporary variables.


Process Control Block

Process States in OS

  • New: The process is being created.
  • Running: The process is being executed.
  • Waiting: The process is waiting for some event to occur.
  • Ready: The process is waiting to be assigned to a processor.
  • Terminate: The process has finished execution.

Many processes can be running in any processor at any time. But, many processes may be in ready queue waiting for states. Consider the figure above depicts the state diagram of the process states.


New to Ready

The operating system creates a process. And prepares the process to be executed by, then the operating system moves the process into the ready queue.

Ready to Running

When it is time to select a process to run, the operating system selects one of the jobs for the ready queue and move the processes from the ready state to the running state.

Running to Terminated

When the execution of a process has completed then the operating system terminates that process from running state. Sometimes the operating system terminates the processes for some other reasons also include time limit exceeded, memory unavailable access violation, protection error, I/O failure, data misuse and so on.

Running to Ready

When the time slot for the processor expires or if the processor receives an interrupt signal, then the operating system shifts the running process to the ready state.

For example, process P1 is being executed by the processor, at that time processor, P2 generates an interrupt signal to the processor. Then the processor compares the priorities of process P1 and P2. If P1>P2 then the processor continues executing P1. Otherwise, the processor switches to process P2, and process P1 is moved to the ready state.

Running to Waiting

A process is put into the waiting state if the process needs an event to occur, or an I/O device is to read. The operating system does not provide the I/O or event immediately then the process is moved to the waiting state by the operating system.

Waiting to Ready

A process in the blocked state is moved to the ready state when the event for which it has been waiting occurs.

For example, a process is in running state needs an I/O devices, then the process moved to wait or blocked state. When the I/O device is provided by the operating system, the process moved to the ready state from waiting or blocked state.


Process vs Program

There are many differences between process and program, some main points are discussed below.
  • A process consists of instruction execution in machine code, but program consists of instruction in any programming language.
  • A process is a dynamic object, but a program is a static object.
  • Process resides in main memory, but program resides in secondary memory.
  • The span of time for the process is limited, but the span of time for the program is unlimited.
  • A process is an active entity and a program is a passive entity.

I hope you have cleared about Process Concept in Operating System.

Process Creation in Operating System