
- OS - Home
- OS - Needs
- OS - Overview
- OS - History
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- OS - TAT & WAT
- OS Processes
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling Algorithms
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithms
- HRRN Scheduling Algorithms
- Priority Scheduling Algorithms
- Multilevel Queue Scheduling
- Context Switching
- Operations on Processes
- Lottery Process Scheduling
- Predicting Burst Time SJF Scheduling
- Race Condition Vulnerability
- Critical Section Synchronization
- Mutual Exclusion Synchronization
- Process Control Block
- Inter Process Communication
- Preemptive and Non-Preemptive Scheduling
- Operating System - Deadlock
- Introduction to Deadlock in Operating System
- Conditions for Deadlock in Operating System
- OS Synchronization
- Operating System - Process Synchronization
- Operating System - Critical Section
- Operating System - Semaphores
- Operating System - Counting Semaphores
- Operating System - Mutex
- Operating System - Lock Variable in Process Synchronization
- Operating System - Turn Variable in Process Synchronization
- Operating System - Bounded Buffer Problem
- Operating System - Reader Writer Locks in Process Synchronization
- Operating System - Test Set Lock in Process Synchronization
- Operating System - Peterson Solution in Process Synchronization
- Operating System - Monitors in Process Synchronization
- Operating System - Sleep and Wake in Process Synchronization
- OS Memory Management
- OS - Memory Management
- OS - Virtual Memory
- OS Storage Management
- File Systems in Operating System
- Linked Index Allocation in Operating System
- Indexed Allocation in Operating System
- Structures of Directory in Operating System
- File Attributes in Operating System
- Operating System - Page Replacement
- Operating Systems - Thrashing
- Belady’s Anomaly in Page Replacement Algorithms
- Optimal Page Replacement Algorithm
- Operating System - Types
- Types of Operating System
- Batch Processing Operating System
- Multiprocessing Operating System
- Hybrid Operating System
- Monolithic Operating System
- Zephyr Operating System
- Nix Operating System
- Blackberry Operating System
- Garuda Operating System
- Tails Operating System
- Clustered Operating System
- Haiku Operating System
- AIX Operating System
- Solus Operating system
- Tizen Operating System
- Bharat Operating System
- Fire Operating System
- Bliss Operating System
- VxWorks Operating System
- Embedded Operating System
- Single User Operating System
- OS Miscellaneous
- OS - Multi-threading
- OS - I/O Hardware
- OS - I/O Software
- OS - Security
- OS - Linux
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Operating System - Operations on Processes
What is a Process in OS?
A process is a program in execution that undergoes a number of states in its lifetime. In each of these states, a process undergoes certain operations that enable the process to execute into completion.
States of a Process
The different states of a process are as follows −
- New − Process is created.
- Ready − Process is ready with all its resource allocation and waiting for CPU allocation.
- Running − Instructions in the process are being executed in CPU.
- Waiting − Process is in waiting for completion of an input output or any other event.
- Terminated − Process finishes execution and exits the system.
The process states are depicted in the following diagram −

Different Process Operations in Operating System
The operations on a process occur when the process is in a particular state or when the process makes a transition from one state to another. There are mainly four operations on a process −
- Process Creation
- Process Dispatch
- Process Pre-emption
- Process Blocking
- Process Termination
Process Creation
The first operation that a process undergoes when it enters a system is process creation. It involves formation of a process and is associated with New state of the process. Process creation occurs due to any of the following events −
- System initialization − When the computer is started, a number of system processes and background processes are created.
- User request − A user may start executing a program leading to creation of a process.
- Child process system call − A running process may create a child process by process creation system call.
- Batch system − The batch system may initiate batch jobs
A process may be created by another process using fork(). The creating process is called the parent process and the created process is the child process. A child process can have only one parent but a parent process may have many children. Both the parent and child processes have the same memory image, open files, and environment strings. However, they have distinct address spaces.
A diagram that demonstrates process creation using fork() is as follows −

Process Dispatch
When a process in the ready state is selected for execution by the scheduler, process dispatch operation occurs. Process dispatch is initiated according to the scheduling algorithm used. It may happen when the CPU becomes idle and the ready queue has processes, time quantum allotted for an on-going process expires, a high priority process enters the system or a hardware interrupt occurs. When a new process is assigned to the CPU, its status is loaded from its Process Control Block (PCB).
Process Preemption
Process pre-emption is an operation by which the execution of an on-going process is suspended and some other process is selected by the CPU for execution. Process pre-emption may occur when time quantum of on-going process expires, a high priority process enters the ready queue or a hardware interrupt occurs.
The preemption of executing processes in the CPU causes a phenomenon called context switch. Here, the context or state of the out-going process is stored in its PCB so that it can be reloaded when required and execution can be resumed from the same point as earlier.
The following diagram demonstrates process dispatch and process pre-emption −

Process Blocking
The on-going process is blocked and put in the Waiting state and swapped out of the CPU, if it needs some event to occur in order to proceed with execution. This event may be an input/output system call since the I/O events are executed in the main memory and don't require the processor.
Here, the operating system blocks the process, when the process itself demands so. After the event is complete, the process again goes to the ready state.
A diagram that demonstrates process blocking is as follows −

Process Termination
Process Termination is the operation of ending a process and releasing all the resources that have been held by the process. The process ceases to exist after its termination.
Similar to process creation, there may be multiple reasons for process termination, as follows −
- The process has completed the execution of its last instruction and so it is terminated by the operating system.
- A child process can be terminated by its parent process if its task is no longer relevant. The child process sends its status information to the parent process before it terminates. Also, when a parent process is terminated, its child processes are terminated as well as the child processes cannot run if the parent processes are terminated.
- The process can be terminated by the operating system if there are service errors.
- A hardware malfunction may also cause process termination.
In most cases, process termination occurs when a process executes to completion. The steps involved are as follows −
- The parent process issues a SIGTERM message to the child process as a signal to initiate termination.
- On receiving this signal, the child process performs clean-up procedures like releasing allocated resources, closing shared files, giving up access to shared variables and tables etc.
- The child process then exits and the control returns to either the parent process or the operating system.