Process States:
State diagram
refer image:click here
From the beginning to the end, the procedure goes through many stages. Five states must be present at a minimum.
Although the process may be in one of the following states during execution, the names of the states are not standardized.
1. New:
A new process is a program that the OS is going to pick up and load into main memory.
2. Ready:
The ready state, where a process waits for the CPU to be assigned, is the first state it enters after being formed. The operating system pulls new processes from secondary memory and places them all in main memory.
The term "ready state processes" refers to processes that are in the main memory and are prepared for execution. Numerous processes might be active at the moment.
3. Running:
The OS will select one of the processes from the ready state based on the scheduling mechanism. As a result, if our system only has one CPU, there will only ever be one process operating at any given time. We can run n processes concurrently in the system if there are n processors.
4. Block or wait:
Depending on the scheduling mechanism or the inherent behavior of the process, a process can move from the Running state to the Block or Wait states.
The OS switches a process to the block or wait state and allots the CPU to the other processes while it waits for a specific resource to be allocated or for user input.
5. Completion or termination:
A process enters the termination state once it has completed its execution. The operating system will end the process and erase the entire context of the process (Process Control Block).
6. Suspend ready:
When a process enters the suspend ready state, it is in the ready state after being transferred from primary memory to secondary memory because primary memory was insufficient.
When a higher priority process has to run but the main memory is already full, the operating system must free up memory by moving the lower priority process to the secondary memory. Until the main memory becomes accessible, the processes that are prepared to suspend remain in the secondary memory.
7. Suspend wait:
It is preferable to unblock the process that is blocking on resources in main memory rather than removing it from the ready queue. It is better if it waits in the secondary memory to free up space for the higher priority process as it is already waiting for a resource to become available. Once the main memory becomes available and their wait is over, these processes end running.
Operations on the Process:
1. Creation:
The process will be ready once it has been created, enter the ready queue (main memory), and be prepared for execution.
2. Scheduling:
The operating system choose one process to begin running from among the numerous processes that are currently in the ready queue. Scheduling is the process of choosing the next procedure to run.
3. Execution:
The processor begins running the process as soon as it is scheduled to run. During execution, a process may become stalled or wait, at which point the processor switches to execute the other processes.
4. Deletion/killing:
The OS will terminate the process once its function has been fulfilled. The Operating System will destroy the process's context (PCB), and the process will be ended.