Process Management in Operating System

Process Management in Operating System

7 mins read32.4K Views Comment
Anshuman
Anshuman Singh
Senior Executive - Content
Updated on May 2, 2024 16:49 IST

There are different processes in the operating system. So there is a need to manage them properly. This article will tell you how an operating system manages different processes.

Process management is a critical component of any operating system. Process management is the backbone of every operating system. Processes are essential for managing system resources and ensuring tasks are completed efficiently and effectively.

In this blog, we will discuss the different process states, different process operations, context switching, and Process management by modern operating systems.

Functions of Operating System
Functions of Operating System
An operating system (OS) is software that manages computer software and hardware resources. Different operating systems have different app stores and could have different applications in them, too. This article...read more

Interprocess Communication in Operating System
Interprocess Communication in Operating System
Processes in operating systems need to communicate with each other. Interprocess communication (IPC) is a process that allows different processes of a computer system to share information. If you want...read more
Recommended online courses

Best-suited Operating Systems courses for you

Learn Operating Systems with these high-rated online courses

– / –
200 hours
– / –
2 months
2 K
20 hours
– / –
3 months
– / –
6 months
3.54 K
1 month
Free
8 hours
2.4 K
6 months

What is a Process?

A process is a program in the execution phase. A process is created, executed, and terminated. A Process goes through these states. We will discuss these states with the explanation. So, in the short process keeps on changing the states. According to a process’s activity, the process’s state is determined. 

 Processes usually fall into two categories-

1. System processes

System processes are started by the operating system, and they usually have something to do with running the OS itself.  

2. User processes

User processes, as you might guess, are those that the user starts. The operating system though handles various system processes, but it mainly handles the user code execution.

Each process can run independently of other processes and have its own memory space. This makes process management tricky, as the OS needs to ensure that each process gets its fair share of resources (memory, CPU time, etc.) while ensuring that the system remains stable.

Process Management

It is an important part of the operating system. It allows you to control the way your computer runs by managing the currently active processes. This includes ending processes that are no longer needed, setting process priorities, and more. You can do it on your computer also.

There are a few ways to manage your processes. The first is through the use of Task Manager. This allows you to see all of the processes currently running on your computer and their current status and CPU/memory usage. You can end any process that you no longer need, set a process priority, or start or stop a service.

2022_06_process-1.jpg

The Role of the Operating System

The operating system is the backbone of your computer. It’s responsible for managing all of your computer’s processes and making it possible for you to interact with your device.

When you boot up your computer, the operating system is the first thing that starts running. It loads into memory and starts managing all of the other programs and processes running on your computer. It also controls files and devices, allocates system resources, and handles communications between applications and users.

In short, the operating system is responsible for making sure that everything runs smoothly on your computer. 

Operating System Interview Questions
Operating System Interview Questions
In this article you will find important operating system questions which are likeable to be asked in interview.
Functions of Operating System
Functions of Operating System
An operating system (OS) is software that manages computer software and hardware resources. Different operating systems have different app stores and could have different applications in them, too. This article...read more
Deadlock in Operating System
Deadlock in Operating System
A deadlock refers to a specific situation where two or more processes within the OS are unable to proceed because they are each waiting for a resource that the other...read more

Process Control Block

2022_06_image-20.jpg

The process control block is a data structure used by an operating system to store information about a process. This includes the process state, program counter, CPU scheduling information, memory management information, accounting information, and IO status information. The operating system uses the process control block to keep track of all the processes in the system.

Attributes of process Description
Process State The process could be in any state, so the current state of the process (ready, running, waiting, terminated)
Process privileges This is required for allowing/disallowing access to the system resource.
Process ID This specifies Unique identification for all processes in the operating system.
Program Counter Contains the address of the next instruction, which will be executed in the process.
CPU registers This specifies the registers that are used by the process. They may include general-purpose registers, index registers accumulators, stack pointers, etc.
Memory management information This includes the memory information like information related to the Segment table, memory limits, and page table.
Accounting information This includes the information about the amount of CPU used for process execution, execution time, time limits, etc.
IO status information There are many Input/Output devices attached to the process, and the list of I/O devices allocated to the process is maintained.
 

Process Operations

Let’s see some operations:

2022_06_operations.jpg

1. Process creation

The first step is process creation. Process creation could be from a user request(using fork()), a system call by a running process, or system initialization.

2. Scheduling

If the process is ready to get executed, then it will be in the ready queue, and now it’s the job of the scheduler to choose a process from the ready queue and starts its execution

3. Execution

Here, execution of the process means the CPU is assigned to the process. Once the process has started executing, it can go into a waiting queue or blocked state. Maybe the process wants to make an I/O request, or some high-priority process comes in.

4Killing the process

After process execution, the operating system terminates the Process control block(PCB).

Process Scheduling: Operating System
Process Scheduling: Operating System
Have you ever wondered how your computer juggles multiple tasks simultaneously? To know that, you must read this blog on process scheduling in the operating system! This article includes...read more

Explore Operating System Online Courses & Certifications

States of the Process 

2022_06_image-16.jpg

1. New state

When a process is created, it is a new state. The process is not yet ready to run in this state and is waiting for the operating system to give it the green light. Long-term schedulers shift the process from a NEW state to a READY state.

2. Ready state

After creation now, the process is ready to be assigned to the processor. Now the process is waiting in the ready queue to be picked up by the short-term scheduler. The short-term scheduler selects one process from the READY state to the RUNNING state. We will cover schedulers in detail in the next blog.

3. Running state

Once the process is ready, it moves on to the running state, where it starts to execute the instructions that were given to it. The running state is also where the process consumes most of its CPU time.

4.Waiting state 

If the process needs to stop running for some reason, it enters the waiting state. This could be because 

  • It’s waiting for some input 
  • It’s waiting for a resource that’s not available yet.
  • Some high-priority process comes in that need to be executed.

Then the process is suspended for some time and is put in a WAITING state. Till then next process is given chance to get executed.

5. Terminate state

After the execution, the process exit to the terminate state, which means process execution is complete.

Difference Between Paging And Segmentation
Difference Between Paging And Segmentation
The main difference between Paging and Segmentation is that Paging divides memory into fixed-size blocks called pages, while Segmentation divides memory based on data type or function into variable-sized segments.

Context Switching in an Operating System

Context switching is the process of switching between tasks or contexts. Basically, the state of the currently executing process is saved before moving to the new process. Saving state means copying all live registers to PCB(Process Control Block)

Context switching can be a resource-intensive process, requiring allocating CPU time, memory, and other resources. In addition, context switching can also cause latency and jitter.

Due to these potential issues, minimising the amount of context switching in your operating system is crucial. By doing so, you can improve performance and stability.

Difference Between Context Switching and Swapping
Difference Between Context Switching and Swapping
The article discusses the concepts of context switching and swapping in OS and covers the difference between context switching and swapping. Swapping and Context Switching in OS are two related...read more

Conclusion

Process management is a critical function of the operating system. By managing processes, the operating system can ensure that resources are used efficiently and that the system remains stable. In addition, process management allows the operating system to control how programs interact with each other. This article has explained process management, different states of the process, and context switching. If you liked this article, please share it with your friends.

Happy Learning!!!

FAQs

What are the common process scheduling algorithms used in operating systems?

Some common process scheduling algorithms include First-Come, First-Served (FCFS), Shortest Job Next (SJN), Round Robin (RR), Priority Scheduling, and Multilevel Queue Scheduling. Each algorithm has its own characteristics, advantages, and limitations, and is chosen based on the system's requirements and priorities.

How does process management differ in multiprogramming and multiprocessing operating systems?

In multiprogramming operating systems, multiple processes are loaded into memory simultaneously, and the CPU switches between them using process scheduling. In multiprocessing operating systems, multiple CPUs or processor cores are available, allowing concurrent execution of multiple processes. Process management in multiprocessing systems involves load balancing, task distribution, and synchronization among the processors.

What is process synchronization?

Process synchronization is the coordination of activities between multiple processes to ensure proper order, timing, and access to shared resources. It involves using synchronization primitives like semaphores, locks, and monitors to enforce mutual exclusion, prevent race conditions, and enable interprocess communication.

About the Author
author-image
Anshuman Singh
Senior Executive - Content

Anshuman Singh is an accomplished content writer with over three years of experience specializing in cybersecurity, cloud computing, networking, and software testing. Known for his clear, concise, and informative wr... Read Full Bio