Earlier there used to be only single-task performing systems. In this way, there used to be only one process running at a time. And it had the freedom to utilise all the resources in the system. But today we have multitasking and multiprocessing operating systems, where more than one process runs at a time.
This creates problems such as deadlock, multiple processes requesting for the same resource, processor, or RAM space allocation to execute.
All these problems require a proper solution, and this instigates the operating system to carry out processor management.
So let us learn more about the process and its management, processor management, how they are being carried out by the operating system, and what are their different stages.
What is a process?
A process or a thread is an active execution unit of a program that performs some action.
We can also say that when a program is loaded in the memory it is called a process. An operating system has the right to create, schedule, and terminate a process. There are four sections in a process-:
- Text: holds the current activities represented by the value of Program Counter
- Stack: holds temporary data such as local variables, functional parameters, return addresses, etc.
- Data: holds the global variables
- Heap: dynamically allocated memory to process during runtime.
The operating system controls a process by a block called Process Control Block (PCB). It is a type of data structure that is maintained by the OS for each process separately. Each PCB can be identified with an integer Process ID (PID), which helps to store all the information required to keep a track of the processes.
PCB can also store the data of processor registers, which are created when a process moves from one state to another.
Let us see the attributes of a process at a glance.
- Process Id: unique identifier assigned by the operating system to each process
- Process State: there are few possible states a process goes through during execution.
- CPU registers: stores the details of the process when it is swapped in and out of the CPU, just like the program counter.
- I/O status information: shows information like the device to which a process is allotted, details of open files.
- CPU scheduling information: processes are scheduled and executed based on priority.
- Accounting & Business information: information about the amount of CPU used and time utilities like a job or process number, real-time utilised, etc.
- Memory management information: information about the value of base registers and limit registers, segment tables, page.
These are the states in which a process might go during its execution. Let us know more about them-:
- New: a new process is created when a certain program is called up from secondary memory and loaded to RAM.
- Ready: a process is said to be in a ready state if it is already loaded in the primary memory/RAM for its execution.
- Running: here the process is already executing
- Paused (Waiting): at this stage, the process is believed to be waiting for CPU or resources allocation.
- Blocked: at this stage, the process is waiting for some I/O operation to get completed.
- Terminated: this specifies the time at which the process gets terminated by the OS
- Suspended: this state shows that the process is ready by it has not been placed in the ready queue for execution.
After gaining insights on the architecture of a process and the various states a process go through, let us see some of its operations:
- Creation: once a process is created, it’s ready to be landed in the ready queue i.e loaded onto the main memory, thus, be ready for its execution.
- Scheduling: OS chooses a process from those present in the ready queue and starts its execution, this whole process is called scheduling.
- Execution: once the process has been scheduled by the OS, the processor starts executing it. If during the execution, the process enters a waiting or blocked state, then it means that the processor is executing other processes.
- Killing: once the process finishes execution, the contexts of PCB get deleted and the process gets terminated by the OS.
Now that we know about a process and its various states and parts, let us learn about its management.
Process management involves tasks related to processing like creation, scheduling, termination, deadlock, etc. The operating systems allocate resources that allow the process to exchange information. It synchronises among processes and safeguards the resources of other processes.
The operating system manages the running processes in the system and performs tasks like scheduling and resource allocation.
Operating systems need an efficient processor in scheduling the process or thread. However, these processors are also managed by the operating systems. But the question lies that what are the concerns that demand the processor to be managed.
Let us see these issues that require the operating system to perform processor management:
- To ensure that each process and application receives enough of the processor’s time to function properly.
- Utilising too many processor cycles as possible for the actual work.
Let us make this more clear with an example:
Suppose your system has Windows XP or Unix operating system. And you wish to work on MS Word. In the background, you decide to play some music. You also have some PDFs and documents opened. Now apart from this your system has antivirus software running behind, you are surfing the net and so on.
So now the operating system needs to manage the network, perform disk and memory management, and do checks on viruses as well.
This is why processor management is needed. All these applications running behind are processes that need the resources and processors’ time for their execution.
Hence, it’s up to the OS now how it manages the processor and does all the tasks concurrently.
The operating system interacts with the hardware of machines and supports the execution of different programs and applications. It communicates with the underlying hardware and connected devices and tries to strike a balance between the two. This is important because CPU execution speed is faster than that of I/O resources.
To establish a connection between the system and virtual hardware, there are some special programs called drivers that are present in the operating system. A few of the main tasks that a driver performs are:
- It acts as a translator between the electric signals of the hardware and the high-level programming languages of the operating system.
- It takes up the data files stored on the operating system and translates them into streams of bits or a series of laser pulses.
- They function just like a process. Any high-priority job is assigned to the driver, by the operating system, so that the system hardware is free.
- New functions can be added to the drivers, without modification, recompilation, and redistribution.
Frequently Asked Questions
Process management involves the creation, scheduling, termination of the process by the operating system. It also deals with the resource allocation to a process.
The operating system needs to manage the processor so that a process gets the time of the processor and it finishes its execution. The operating system also manages processor cycles.
The four types of operating systems are: Multi-tasking Operating System, Real-time Operating System, Network-based Operating System, Distributed Operating System.
A process is controlled by the operating system through its PCB. All the operations of a process like its creation, scheduling, and termination are under the control of the operating system.
Business Process Management tools are used to design a systematic approach to automate business processes and solve business-related issues. Eg: BPM
The two steps of process execution are the creation of the process and loading the process into the running queue for its execution.
Since operating systems is one of the most popular topics among the interviewers, students generally have a weak hand when coming to OS. So if you are preparing for any company’s interview then Coding Ninjas’ short-term course on Operating Systems will benefit you.
It is a two-month course and here you will be taught the core concepts of the operating systems that will help you ace the interviews. And this is not enough, you will be working on 150+ practice problems of operating systems that have been previously asked during the interviews of some tech giants.
If you are interested to know more about operating systems you can check out Coding Ninjas’s Operating System Guide To know more about the different kinds of operating systems available checkout Coding Ninjas blog on Types of Operating Systems.
You may also find the below-mentioned links useful if you are looking for some exclusive content on operating systems-:
- Operating Systems Tutorials with code explained
- How to choose a good OS?
- Top operating systems for programmers
This was all you need to quench your thirst to know about Processor Management. Hope this helps you out in preparing for tech giants. You can also check out some exclusive in-demand courses offered by Coding Ninjas.
By Shivi Srivastava