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
  • Waiting Time: The difference between turnaround time and burst time.
    • Formula: Waiting Time = Turnaround Time - Burst Time

Key criteria CPU scheduling algorithms include:

  1. 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.
  2. Throughput

    • The number of processes completed per unit time.
    • Throughput depends on the length and duration of processes.
  3. 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.
  4. Waiting Time

    • The time a process spends waiting in the ready queue.
    • Scheduling algorithms aim to minimize this time.
  5. 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.