RTUComputer ScienceYr 2023 · Sem 52023

Q2Operating System

Question

4 marks

Describe the various CPU scheduling algorithms.

Answer

An analytical review of CPU Scheduling algorithms, mathematically comparing First-Come First-Serve (FCFS), Shortest Job First (SJF), and the time-sliced Round Robin (RR) protocols.

In a multiprogramming architecture, the OS Kernel utilizes a highly aggressive component known as the Short-Term Scheduler (or CPU Scheduler). Its singular mathematical objective is to select the absolute most optimal process from the Ready Queue and violently inject it into the CPU for execution, maximizing CPU utilization and minimizing wait times.

1. First-Come, First-Served (FCFS)

The most primitive, non-preemptive scheduling architecture. - Mechanism: It operates on a strict FIFO (First-In, First-Out) mathematical queue. The process that arrives first is aggressively locked into the CPU and absolutely refuses to surrender control until it is completely finished. - Demerit (The Convoy Effect): If a massive, CPU-heavy process arrives first (taking 100 seconds), it will violently block 50 tiny processes (taking 1 second each) stuck behind it, causing catastrophic average wait times.

2. Shortest Job First (SJF)

The absolute mathematically optimal scheduling algorithm for minimizing average wait time. - Mechanism: The Scheduler aggressively scans the Ready Queue, evaluates the estimated execution time (Burst Time) of every process, and strictly selects the process with the shortest mathematical burst time. - Demerit (Starvation): If a massive process is waiting, and a continuous stream of tiny processes keeps arriving, the massive process will mathematically never receive CPU time. It will violently starve to death in the queue.

3. Round Robin (RR)

The foundational architecture for all modern Time-Sharing systems. It is aggressively preemptive. - Mechanism: The Kernel mathematically defines a strict Time Quantum (e.g., 10 milliseconds). The CPU executes a process for exactly one quantum. If the process is not finished, a hardware interrupt is violently triggered. The OS forcibly yanks the process out of the CPU, shoves it to the back of the queue, and loads the next process. - Merit: Guarantees absolute fairness and incredible responsiveness; no process can ever monopolize the CPU or starve.

Back to Paper