Process States in Operating System |
A process is a running application in an operating system. Now a process passes through various stages or phases when it is in execution. With these phases in mind, it then becomes easier to understand how the operating system manages the operations of a computer and how well this system works.
Which must have at least five states involved.
The states' names are not standardized, even though the procedure might be in any of these states while it's running. Throughout its life cycle, every process goes through multiple stages.
Process States in Operating System
1.New State
The process is not yet created, but it is on the verge of being created at this step. The OS will select the program stored in secondary memory in order to start the process.
2.Ready State
Once a process is loaded into the main memory and it has been prepared for execution, it will move from a new to ready state. Being in the ready state means that it is just waiting for the processor to execute it. Scenario 1 – Presence of Multiple Processes In a multiprogramming environment there can be a large number of processes in the ready state.
3.Running State
The process state changes to Running whenever the CPU is assigned to it from the ready queue.
4.Block or Wait State
Depending on the scheduling mechanism or the inherent nature of the process, a process can move from the Running state to the block or wait state.
The OS moves a process to the block or wait state and distributes the CPU to the other processes while it waits for a resource to be assigned or for user input.
5.Terminate State
A process transitions from the run state to the terminate state when its execution is complete. When the operating system reaches the terminate state, it removes the process control box, or PCB.
6.Suspend Ready State
The process transitions from the ready to the suspend ready state if a higher priority process must run while the main memory is full. A higher-priority process can take up less space in the ready state by moving a lower-priority process from the ready state to the suspend ready state.
The process remains in the suspend-ready state until the main memory is freed. When the primary memory is made available, the process is brought to its ready state.
7.Suspend Wait State
Similar to suspend ready, except instead of using main memory, they moved to secondary memory because they were using the process that was carrying out an I/O operation. After completion, the task may go to suspend ready.
8.CPU and I/O Bound Processes:
A process is referred to as CPU-bound if it requires a lot of CPU operations. Likewise, a process is referred to as I/O-bound if it requires a lot of I/O operations.
Operations on the Process
1. Creation
The process will be prepared for execution as soon as it is formed, ready to enter the main memory's ready queue and begin running.
2.Scheduling
Understanding these phases makes it easier for us to comprehend how the operating system regulates operations, ensuring that the computer runs smoothly.
At least five states need to be involved.
Scheduling is the process of deciding which procedure will be carried out next.
3.Execution
At the time of its turn in scheduling, the process is executed by processor. While a task is being executed, it might enter into the blocked or wait state; at that moment, the processor will start executing contradictory processes.
4.Deletion/killing
The OS will terminate a process as soon it has served its purpose. The OS will clean up the context for a process, called PCB and kill the process.
5.Blocking
A process is said to be blocked while it awaits a resource or event. It will be put in a blocked state by the operating system, preventing it from running until the resource or event becomes available.
6.Resumption
A process is brought back into the ready queue and is taken out of the blocked state when the resource or event that caused it to block becomes available.
7.Context Switching
The operating system needs to load the context of the next process to run and save the current process's context when it moves from one process to another. We call this context flipping.
8.Inter-Process Communication
In order to exchange information or plan actions, processes may need to speak with one another. Mechanisms for inter-process communication, including shared memory, message forwarding, and synchronization primitives, are provided by the operating system.
9.Process Synchronization
It is possible for several processes to require concurrent access to a common resource or crucial code segment. To guarantee that only one process at a time can access the resource or crucial area, the operating system offers synchronization mechanisms.
10.Process States
There are various states in which processes can be found, such as ready, running, waiting, and terminated. The process states and their transitions are controlled by the operating system.
Features of The Process State
- When waiting for a resource to become available, a process can switch from the running to the waiting states.
- Upon the availability of the resource it was waiting for, a process can transition from the waiting state to the ready state.
- When the operating system chooses a process for execution, it can transition from the ready state to the running state.
- The operating system selects a process to run from the ready state based on a scheduling mechanism.
- The operating system may also move a process from the running to the ready state to allow for the execution of other processes.
- After its execution is finished, a process can transition from the running state to the terminated state.
- If a process is terminated by the operating system or another process, it can go straight from the waiting state to the terminated state.
- Throughout its lifetime, a process can enter the ready, running, and waiting states multiple times; however, it can only enter the new and terminated states once.
- The program counter, CPU registers, memory usage, and other resources utilized by the process are all included in the process state information.
- For every process, the operating system keeps track of a process control block (PCB) that holds details on the process's priority, state, scheduling, and other relevant information.
- An important idea in operating system process management is the process state diagram, which is used to show how a process changes between several stages.
Conclusion
In conclusion, knowing an operating system's process states is crucial to understanding how the system effectively handles several processes. The states of new, ready, running, waiting, and terminated indicate several phases in the life cycle of a process. The operating system makes sure that procedures are carried out without hiccups, resources are distributed efficiently, and the computer's overall performance is maximized by moving between these states. This understanding enables us to recognize the intricacy and effectiveness of contemporary computing's internal workings.
What is process states in operating system?
Process refers to the program that is now in use. Throughout their life cycle, processes go through many phases that are referred to as process states. Throughout its life cycle, a process can be in one of the following states: new, ready, running, waiting or blocked, terminated or completed, suspend ready, suspend wait or blocked, and so on.
How many states are there in process life cycle?
At least five states need to be involved.
The states' names are not standardized, even though the procedure might be in any of these states while it's running. Throughout its life cycle, every process goes through multiple stages.
Which five fundamental stages make up a process?
Five states of a process
New.
Ready.
Running.
Wait/Block.
Termination.
What is the difference between process and cycle?
A process is the movement of a system along a predetermined path from one state point to another. A cycle is a set of two or more operations that encircle a certain area and create a closed loop that returns to the starting point.
Does a process go straight from the "running" to the "ready" state?
Yes, if a process chooses to give up the CPU or is interrupted by a higher priority process, it can transition from the "running" to the "ready" state.