Process Management & Scheduling
Expert Answer & Key Takeaways
Understanding Processes, the Process Control Block (PCB), States of a process, and CPU Scheduling algorithms (FCFS, SJF, Round Robin).
Process Management
A Process is a program in execution. A program itself is passive (just code sitting on a hard drive). It becomes an active process only when it is loaded into memory (RAM) and its execution begins.
1. Process States
As a process executes, it changes state. The standard states are:
- New: The process is being created.
- Ready: The process is in RAM, waiting to be assigned to a CPU.
- Running: Instructions are being executed by the CPU.
- Waiting (Blocked): The process is waiting for some event to occur (like I/O completion or user input).
- Terminated: The process has finished execution.
2. Process Control Block (PCB)
The OS needs to keep track of all running processes. It does this using a data structure called the Process Control Block (PCB). Every process has its own PCB.
The PCB stores critical information:
- Process State (Ready, Running, etc.)
- Process ID (PID)
- Program Counter (Where the process left off)
- CPU Registers
- Memory allocation information Context Switch: When the CPU switches from one process to another, it must save the state of the old process (into its PCB) and load the saved state for the new process (from its PCB). This is called a Context Switch. It is pure overhead (the system does no useful work while switching).
3. CPU Scheduling
In a multiprogramming system, there are often more processes ready to run than there are CPUs. The CPU Scheduler decides which process in the 'Ready' queue gets the CPU next.
Types of Scheduling:
- Non-Preemptive: Once a process gets the CPU, it keeps it until it voluntarily gives it up (terminates or goes to wait state).
- Preemptive: The OS can forcefully interrupt a running process and take the CPU away from it (usually based on a time limit or priority).
4. Scheduling Algorithms
4.1 First-Come, First-Served (FCFS)
- The process that requests the CPU first gets it first.
- Non-preemptive.
- Problem (Convoy Effect): A very long process can hold up the CPU, making many short processes wait behind it.
4.2 Shortest Job First (SJF)
- The CPU is assigned to the process that has the smallest next CPU burst (execution time).
- Can be preemptive or non-preemptive.
- Advantage: Gives the minimum average waiting time.
- Problem (Starvation): Long processes might wait forever if short processes keep arriving.
4.3 Round Robin (RR)
- Designed specifically for time-sharing systems.
- Preemptive.
- Each process gets a small unit of CPU time called a Time Quantum (e.g., 10 milliseconds).
- After the quantum expires, the process is forcefully paused and put at the back of the Ready queue.
- Advantage: Fair to all processes, highly responsive for users.
4.4 Priority Scheduling
- Each process is assigned a priority number. The highest priority process gets the CPU.
- Problem (Starvation): Low priority processes may never run.
- Solution (Aging): Gradually increasing the priority of processes that wait in the system for a long time.
Course4All Editorial Board
Verified ExpertSubject Matter Experts
Comprising experienced educators and curriculum specialists dedicated to providing accurate, exam-aligned preparation material.
Pattern: 2026 Ready
Updated: Weekly
Found an issue or have a suggestion?
Help us improve! Report bugs or suggest new features on our Telegram group.