process management in os
operating system tutorial notes

Process Management in OS and Process State Diagram

Process Management in Operating System

Process management in operating system is one of the important function performed by the operating system. In context to process operating system is responsible for various activities. We will learn about this in this tutorial.

Process management in operating system is also an important topic for technical interview. Most of the software company asked some questions on process management in technical round of the interview.

Computer science students are advised to prepare process management chapter of operating system very well.

Some tricky multiple choice questions based on process management in operating system are also asked in GATE(CS/IT) and UGC NET( CS) Exam. Every year problems based on cpu scheduling algorithms are asked in  GATE(CS/IT) and UGC NET exam.

I have prepared this process management in os tutorial for computer science students and GATE/UGC NET aspirants.

Frequently Asked Questions

By the end of this tutorial students will got the answer of the following questions

  • Define process.
  • Write the difference between program and process.
  • Explain process management function of os.
  • How a process is represented in memory ?
  • What are different states of a process?
  • Draw a process state diagram.

What is Process ?

When we start to study the process management in os then first question that comes in mind is what is process and what is difference  between program and process?

So let me clear the answer of this question a process is a program in execution. Process is an active entity where as program is  a passive.

The term program is used when user data or instruction is on disk but as soon as program is loaded into memory for execution it becomes a process.

Now come to the further discussion to understand the topic process management in operating system.

What is Process Management in OS ?

Operating system is responsible to perform the several activities in context of a process. management of all these activities is simply known as process management. Operating system performs the following tasks during process management.

Creation and Termination of Process

Operating system can creates a child process of currently running process during its execution. After the successfully completion operating system terminates the process.

Memory Allocation to Process

When a process is submitted to system then it should be loaded in memory for its execution. Operating system find the free memory space in main memory and allocate some memory space t this newly arrived process as per the process need to the process.

Scheduling of Process

In multiprogramming environment there are several processes available in main memory at a time. In this situation operating system decides the order of execution for the process.

This order of execution is known as process scheduling or cpu scheduling and this is depends on the cpu scheduling algorithm to be used. This is also known as order of allocation of processor to the process which are in ready state.

CPU Scheduling Information help in improving the performance of the CPU.

Various CPU Scheduling Criteria’s are there to measure the performance of CPU.

De-allocation of Memory  from Process

Operating system also deal locate the memory from the process after it’s completion so that this free memory space can be allocated to the newly arrived process.

Process Representation in Memory

When a program is loaded into the memory and it becomes a process now in memory process can be represented by using  four sections ─ stack, heap, text, and data. This is also known as abstract view of process.
Figure 1 represents layout of a process inside main memory.
      process management in os
Let’s discuss about each part one by one –
    Stack: Stack contains the temporary or local data such as method/function parameters, return address, and local variables related to a process.
    Heap: Heap is a  dynamically allocated memory to a process when process is under execution.
 Text: Text section of  the process tells about  the current activity which is  represented by the value of Program Counter and the contents of the processor’s registers.
 Data: Data section contains the global and static variables.

Process States Diagram

When a process is created and when it terminated from beginning to end during its life cycle a process can remain in many states. Different process states in operating system are represented in following process state transition diagram in operating system.
Figure 2 represent State Transition diagram for a process
process management in os
Let’s see these state one by one.
New: First state is Start or new  state. A process is said to be in new state when it is  started or created.

Ready: It is the state next to new state .  The process is said to be in ready state when it is waiting to be assigned to a processor. Ready processes are waiting to have the processor allocated to them by the operating system so that they can run.

A process may come into ready  state in  three situation first is just after the Start state, second situation may be  while running and getting interrupted by the scheduler to assign CPU to some other process in this situation it comes to ready state so that cpu can execute the new process.

Third situation from wait state when I/O is completed or wait for an even is completed.

Running: Once the process has been assigned to a processor by the OS scheduler, the process state is set to running and the processor executes its instructions then process is said to be in running state.
Waiting: When a process is in running state then  process moves into the waiting state if it needs to wait for a resource, such as waiting for user input, or waiting for a file to become available.
Terminated: Once the process finishes its execution, or it is terminated by the operating system, it is moved to the terminated state where it waits to be removed from main memory.

Conclusion and Summary

In this process management in operating system tutorial we have discussed the following important concepts

  • Introduction of process and difference between program and process.
  • Abstract view of process in memory.
  • Process management function of operating system.
  • Process states or process state diagram.

I hope that this process management in operating system tutorial based will be helpful for computer science students in understanding the basic concepts of process.

In the next tutorial we will learn about other important concept of process that is process control block diagram.

Previous TutorialTypes of Operating System

Next Tutorial –  Process Control Block 

Leave a Reply

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