> For the complete documentation index, see [llms.txt](https://codexpress.gitbook.io/operating-system-showdown/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codexpress.gitbook.io/operating-system-showdown/process-management/process-scheduling/comparison-of-scheduling-algorithms.md).

# Comparison of Scheduling Algorithms

Here is a brief comparison between different CPU scheduling algorithms:

| Algorithm               | Allocation is                                                                                             | Complexity                                                            | Average waiting time (AWT)                                        | Preemption | Starvation | Performance                                       |
| ----------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------- | ---------- | ---------- | ------------------------------------------------- |
| FCFS                    | According to the arrival time of the processes, the CPU is allocated.                                     | Not complex                                                           | Large.                                                            | No         | No         | Slow performance                                  |
| SJF                     | Based on the lowest CPU burst time  (BT).                                                                 | More complex than FCFS                                                | Smaller than FCFS                                                 | No         | Yes        | Minimum Average Waiting Time                      |
| LJFS                    | Based on the highest CPU burst time (BT)                                                                  | More complex than FCFS                                                | Depending on some measures e.g., arrival time, process size, etc. | No         | Yes        | Big turn-around time                              |
| LRTF                    | Same as LJFS the allocation of the CPU is based on the highest CPU  burst time (BT). But it is preemptive | More complex than FCFS                                                | Depending on some measures e.g., arrival time, process size, etc. | Yes        | Yes        | The preference is given to the longer jobs        |
| SRTF                    | Same as SJF the allocation of the CPU is based on the lowest CPU burst time (BT). But it is preemptive.   | More complex than FCFS                                                | Depending on some measures e.g., arrival time, process size, etc  | Yes        | Yes        | The preference is given to the short jobs         |
| RR                      | According to the order of the process arrives with fixed time quantum  (TQ)                               | The complexity depends on TQ  size                                    | Large as compared to SJF and Priority scheduling.                 | No         | No         | Each process has given a fairly fixed time        |
| Priority Pre-emptive    | According to the priority. The bigger priority task executes first                                        | This type is less complex                                             | Smaller than FCFS                                                 | Yes        | Yes        | Well performance but contain a starvation problem |
| Priority non-preemptive | According to the priority. with monitoring the new incoming higher  priority jobs                         | This type is less complex than Priority preemptive                    | preemptive Smaller than FCFS                                      | No         | Yes        | Most beneficial with batch systems                |
| MLQ                     | According to the process that resides in the bigger queue priority                                        | More complex than the priority scheduling algorithms                  | Smaller than FCFS                                                 | No         | Yes        | Good performance but contain a starvation problem |
| MFLQ                    | According to the process of a bigger priority queue.                                                      | It is the most Complex but its complexity rate depends on the TQ size | Smaller than all scheduling types in many cases                   | No         | No         | Good performance                                  |
