FCFS is the simplest CPU scheduling algorithm where processes are executed in the order they arrive in the ready queue. It is a non-preemptive algorithm.
Processes are executed in the order they arrive
Non-preemptive: once a process starts executing, it continues until it completes
Simple to implement but can lead to the "convoy effect" where short processes wait for long processes to complete
Shortest-Job-First (SJF)
SJF selects the process with the smallest burst time from the ready queue. It is optimal in terms of average waiting time for a given set of processes.
Selects the process with the smallest burst time next
Non-preemptive: once a process starts executing, it continues until it completes
Optimal for minimizing average waiting time but requires knowing/estimating burst times in advance
Priority Scheduling
Priority scheduling assigns a priority to each process and the CPU is allocated to the process with the highest priority (lowest priority number).
Each process has a priority value (lower number = higher priority)
Process with highest priority is selected next
Non-preemptive: once a process starts executing, it continues until it completes
Can lead to "starvation" where lower priority processes wait indefinitely
Round Robin (RR)
Round Robin is a preemptive scheduling algorithm that assigns a fixed time slice (quantum) to each process in a circular queue.
Each process gets a small unit of CPU time (time quantum)
Preemptive: if a process doesn't complete within its time quantum, it's moved to the back of the ready queue
Fair allocation of CPU time to all processes
Time quantum selection is critical: too small increases context switching overhead, too large makes it similar to FCFS