CPU Scheduling - aryanjoshi0823/5143-Operating-System GitHub Wiki
CPU scheduling is a process used by the operating system to decide which task or program gets to use the CPU at a particular time. Since many programs can run simultaneously, the OS needs to manage the CPU’s time so every program gets a proper chance to run. The purpose of CPU scheduling is to make the system more efficient and faster.
CPU scheduling is a key part of how an operating system works. It decides which task (or process) the CPU should work on at any given time. This is crucial because a CPU can only handle one task at a time, but there are usually many tasks that need processing.
Terminologies Used in CPU Scheduling
Here are some key terms often used in CPU scheduling:
- Arrival Time: The time at which a process enters the ready queue.
- Completion Time: The time at which a process completes execution.
- Burst Time: The time required by a process for CPU execution.
- Turnaround Time: The difference between the completion time and the arrival time.
- Formula:
Turnaround Time = Completion Time - Arrival Time
- Formula:
- Waiting Time: The difference between turnaround time and burst time.
- Formula:
Waiting Time = Turnaround Time - Burst Time
- Formula:
Key criteria CPU scheduling algorithms include:
-
CPU Utilization
- The primary goal is to keep the CPU as busy as possible.
- Utilization typically ranges from 40% to 90% in real-time systems, depending on the load.
-
Throughput
- The number of processes completed per unit time.
- Throughput depends on the length and duration of processes.
-
Turnaround Time
- The total time taken for a process from submission to completion.
- Includes time waiting for memory access, CPU usage, and I/O operations.
-
Waiting Time
- The time a process spends waiting in the ready queue.
- Scheduling algorithms aim to minimize this time.
-
Response Time
- In interactive systems, response time measures how quickly a process produces its first output.
- It’s the time between process submission and the first response.