Day 02Part 02- Operating System for Computer Science – When we required CPU scheduling
Here’s a clear explanation for “Day 02 Part 02 – Operating System (OS) for Computer Science: When We Require CPU Scheduling” — great for GATE, UGC NET, university exams, or general understanding.
Contents
Topic: When Do We Require CPU Scheduling in an Operating System?
What Is CPU Scheduling?
CPU scheduling is the process of selecting one process from the ready queue and assigning the CPU to it.
The Operating System’s scheduler decides which process gets the CPU and when, based on scheduling algorithms (like FCFS, SJF, Round Robin, etc.).
When Is CPU Scheduling Required?
CPU scheduling is required only when the CPU becomes idle and needs to choose the next process to execute.
More specifically, CPU scheduling is needed in the following cases:
1. When a Process Switches from Running to Waiting
Example:
- A process requests I/O → It leaves CPU
- CPU is free → Scheduler picks another process from the ready queue.
2. When a Process Switches from Running to Ready
This happens in preemptive scheduling (like Round Robin or Priority Scheduling).
Example:
- A process is running.
- A higher-priority process arrives.
- OS preempts current process and schedules the new one.
3. When a Process Switches from Waiting to Ready
Example:
- A process finishes I/O.
- Now it’s ready to execute again.
4. When a Process Terminates
- The running process completes.
- CPU becomes idle.
When It’s Not Required:
If only one process is running and no others are ready or waiting, no scheduling is needed.
Summary Table:
Event | CPU Scheduling Required? |
---|---|
Running → Waiting | |
Running → Ready (Preemption) | |
Waiting → Ready | |
Process Termination | |
Only one process exists (no competition) |
Why It’s Important (in OS Exams or GATE):
- Forms the basis for scheduling algorithm design.
- Helps in understanding context switching, CPU utilization, and response time optimization.
If you’d like, I can give you:
A printable revision note (PDF) Chart comparing different scheduling algorithms Script for explaining this in a short video format
Let me know how you’d like to study this!