Learn Operating System Processes in easy language
Operating System is a vast subject to study. It begins with its functions which include memory management, processor management, device management, file management and the other important activities. It also has various types such as a batch operating system, time-sharing system, a distributed operating system, network operating system, real-time. There is an extensive list of services which it offers. In this piece of writing, we will concentrate on the processes and their scheduling.
WHAT IS A PROCESS?
A program which is in execution is termed as a process. The procedure must sequentially progress its implementation. In other words, a process is an entity whose primary function is to represent the basic unit of work which has to be implemented in the system. When the code is yet to get the CPU and the processor, then it is called a program. But when we write the code into the text file and it goes for execution then it becomes a process. There is a similarity in both the programs and the processes. They both perform the same tasks.
FOUR SECTIONS OF A PROGRAM
After the loading of a program into the memory, and after becoming a process, the program is then divided into four sections. These are as follows-
The components and description of these four sections-
It contains the temporary data such as method/function parameters, local variables and returns address etc.
The allocated memory in the dynamic way which is given to a process during its runtime is called the heap process.
Text process is the composition of the current activity. The value of the program counter and the contents of the registers of the processor represent it.
The global and the static variables are contained in the data process out of the four sections.
EQUATE YOURSELF WITH THE INFORMATION OF A PROGRAM
The piece of code with a flexible number of coding lines is called a computer program. It is written in the programming language by the computer programmers. You can also read the definition of the computer program as a set of instructions which are formed to perform a specific task on their execution. If you want to have a comparison between the two terms, a process and a program, then learn that the dynamic instance of a computer program is a process.
An algorithm is a part of a computer program which performs a well-defined task. Whereas, software is the collection of computer programs, data and the libraries is known as software.
PROCESS LIFE CYCLE AND ITS VARIOUS STAGES
There are numerous states in the execution of the process. But they do not remain the same in all the operating systems. Similarly, the names of the states through which they go through are not standardised.
When there are the creation and the starting of the process, then we consider it is an initial state.
When the process waits for its assessment to a processor, it is said to be in the ready state. The methods which are in the ready state are waiting to have the processor to get the privilege of having the operating system for its use are waiting to run. There are two ways to reach this state. It can be either from the start state or when they are running but interrupted by the scheduler so that it can assign the CPU to any other process.
After the OS scheduler has assigned the processor to a program, the state becomes a running state. Once it is done, the processor starts the execution of its instructions.
If any process needs some resources while being in the running state, then it enters the waiting state. That process can have any requirement, be it the user input, or any file to become available.
TERMINATED OR EXIT
After any process is finished with its execution part, then it is moved to the terminated state. Operating System concludes this and removes it from the main memory.
PROCESS CONTROL BLOCK (PCB)
It is the data structure which the operating system maintains for every process is called a process control block. Integer Process ID is the identifier of the PCB. Keeping all the information which is needed to keep track of a process is assigned to a PCB.
- Process State
It includes all the current states of the process. These can be a ready state, running state, waiting or the next stages.
- Process privileges
These rights and the privileges are required for the allowing and the disallowing the access to system resources.
- Process ID
It makes unique identification for each of the processes in the operating system.
It points to a parent process.
- Program Counter
It takes the instruction to be executed for this process to the next address.
- CPU registers
This store the process for the execution of the running state.
- CPU scheduling information
The scheduling information and the process priority which are needed to schedule the process is progressed by the CPU scheduling information.
- Memory management information
All the information on the page table, segment table which depends on memory used by the operating system and the memory limits is included under this.
- Accounting Information
Accounting information accredits the amount of CPU used for the execution of the process, time limits and the execution ID etc.
- IO status information
In this context, we have a list of input and the output devices allocated to the process.
There is different information in different operating systems. Similarly, the architecture of a Process Control Block is entirely dependent on the Operating System. Every process has the same process control block throughout its lifetime. The PCB is deleted only after the termination of that process.
In this part of the information of the operating system, we saw the processes, programs, the four sections, process life cycle and PCB and its architecture in simple words. The next blogs will be on the further topics of the subject such as the process scheduling and the algorithms attached to them.