What is CPU scheduling algorithm ?

A CPU scheduling algorithm is a method used by the operating system to determine which process gets to use the CPU (processor) and for how long. When multiple processes are ready to run, the scheduler decides the order based on a particular algorithm.

Because a CPU can run only one process at a time (in a single-core system), while multiple processes may be ready to execute. Efficient scheduling improves:

Learn More

First-Come, First-Served (FCFS)

Processes are executed in the order they arrive in the ready queue. It's non-preemptive and simple but may cause high average waiting time.

Know More

Shortest Job First (SJF) / Shortest Job Next (SJN)

Executes the process with the shortest burst time first. It can be preemptive (Shortest Remaining Time First) or non-preemptive. Minimizes average waiting time but may lead to starvation.

Know More

Round Robin (RR)

Round Robin is a preemptive CPU scheduling algorithm where each process is assigned a fixed time quantum and scheduled in a cyclic order. The CPU executes each process for a maximum of one time slice; if the process doesn’t finish in that time, it is paused and placed at the end of the queue. This continues until all processes are completed.

Know More

Longest Job First (LJF)

Opposite of SJF - the process with the longest burst time is executed first. Can be preemptive or non-preemptive but may lead to increased waiting time for shorter tasks.

Know More

Priority Scheduling

Each process is assigned a priority, and the CPU is allocated to the process with the highest priority. It can be preemptive or non-preemptive. Risk of starvation exists for low-priority processes.

Know More