CPU Scheduling Algorithms

Deciding which process has to be executed first and which process has to be executed later is done through CPU scheduling algorithms. OS also uses CPU Scheduler to schedule different processes.

Types of CPU Scheduling 

1. Non-preemptive scheduling

Every new process has to wait until the running process finishes its CPU cycle or completes its execution.

2. Preemptive scheduling

It allows a running process to be interrupted by a high-priority process. 

Note: But the condition In both cases (preemptive and non-preemptive) is if any interrupt occurs during the process execution. Then, the CPU leaves the current running process and shifts to that interrupt.

Some scheduling algorithms in Non-preemptive are

  1. First Come First Serve (FCFS)
  2. Shortest Job First (SJF)
  3. Highest Priority (0 is the highest priority)
  4. Highest response ratio Next (HRRN)

Some scheduling algorithms in preemptive are

  1. Shortest remaining time first
  2. Round Robin
  3. Priority Based
  4. Multilevel Queue
  5. Multi-level feedback

The Purpose of CPU Scheduling Algorithm

  1. Maximum utilization of CPU
  2. Maximum throughput
  3. Minimum waiting time
  4. Highly responsive

We will explain preemptive and non-preemptive types, with examples in the next lectures.