We all are aware of the computer and the operating system. All the CPU activities that are going on are termed as a process in an operating system. Well, there are several definitions of the term ‘process’ in the operating system.
Like, some call process as a program or an instance of a program that is currently in execution. Some call it as an entity that can be executed on the processor. Some call it as a unit of activities which contains a sequence of instructions that are in execution.
Concept of Process in Operating System
In the early batch systems, CPU activities are termed as jobs. When it comes to time-sharing system the CPU activities are termed as user programs or tasks. And the single-user system like Windows where even the user is executing one program at a time the CPU is involved in its own programmed activities like memory management. All these activities performed by CPU is termed as a process.
In the operating system for all CPU, activities are preferred by the term process. The process is not only the set of instructions, which is known as a text section it has many more to concern about. In the section below we have discussed all the elements of the process.
Elements of Process
The two most important components of a process are program code and a set of data. The program code is a set of instructions whereas, the set of data is the collection of data that is associated with the code of the program. Now, consider that the processor starts executing the program code along with the data associated with it then it is called a process.
Well, when the process is in execution it can be characterized by element discussed below:
- Identifier: Every process has a unique identification which helps the processor to distinguish between the processes. Every process has a process Id which acts as an identifier for that process.
- State: A process can be in a ready state, waiting state, new state and terminating state.
- Priority: There are several processes in the system. But each process must have a priority level which helps the processor in deciding what process should be responded first.
- Program Counter: As we have seen a process has a program code which has a set of instructions. The program counter helps the processor to identify which instruction is be executed next.
- Memory Pointer: The memory pointer contains the pointer to the program code and to the data that is associated with the program.
- Context Data: While the process is executing the processor stores the intermediate results in the registers which are referred to as context data.
- I/O Status Information: A process may require the I/O devices for which it makes the I/O requests. It also has information about the files used by the process.
- Accounting Information: The accounting information has the information about the time spent by the process on the processor.
All this information is organized inside a data structure and it is termed as the process control block.
Process Control Block
The operating system creates a process control block for each process. A process control block has all that information about the process which would help the processor to interrupt any process which is currently executing and also resume the interrupted process. The diagram below shows the process control block.
The operating system creates as well as manages the process control block. It is all because of the process control bock that an operating system has the ability to support multiprocessing.
From the moment the process is ready for execution and till it gets executed it changes its state. The state of the process can be identified by its current activity. At a time a process can be in only one state. Below are the states of the process.
- New: A process is in a new state when it is just created.
- Ready: A process is in a ready state when it is prepared for execution.
- Running: A process is in the running state when it is instructions are getting executed.
- Waiting: When the operating system put the process on hold for some time it is in waiting state.
- Terminated: When the process has completed its execution it gets terminated.
The current state of the process is updated by the operating system in the process control block.
So, we have discussed a process in the operating system. We have also discussed its characterizing elements. We have also discussed the states of the process and remember at a time process can only be in one state.