0% found this document useful (0 votes)
10 views

CPU scheduling algo

The document outlines various CPU scheduling algorithms including First-Come, First-Served (FCFS), Shortest Job First (SJF), Shortest Remaining Time First (SRTF), and Round Robin (RR). Each algorithm is described with its main concept, advantages, disadvantages, and whether it is preemptive or non-preemptive. The document emphasizes the trade-offs involved in choosing different scheduling methods, particularly in terms of waiting time and process starvation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

CPU scheduling algo

The document outlines various CPU scheduling algorithms including First-Come, First-Served (FCFS), Shortest Job First (SJF), Shortest Remaining Time First (SRTF), and Round Robin (RR). Each algorithm is described with its main concept, advantages, disadvantages, and whether it is preemptive or non-preemptive. The document emphasizes the trade-offs involved in choosing different scheduling methods, particularly in terms of waiting time and process starvation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical

CPU Scheduling Algorithms

💡 Harsh Pratap Singh 22BCE10894

First-Come, First-Served (FCFS)


Main concept: Jobs are executed in the order they arrive in the ready queue

Advantages: Simple to implement and understand

Disadvantages: Suffers from convoy effect, where short processes wait behind long ones

Non-preemptive: Once a process starts executing, it continues until completion


code :

Shortest Job First (SJF)


Main concept: Selects the process with the smallest burst time to execute next

Practical 1
Advantages: Optimal average waiting time among non-preemptive algorithms

Disadvantages: Starvation of longer processes, difficult to predict burst times

Non-preemptive: Process runs to completion once started


code :

Shortest Remaining Time First (SRTF)


Main concept: Preemptive version of SJF, always runs the process with shortest remaining
time

Advantages: Optimal average waiting time among all scheduling algorithms

Disadvantages: High context switching overhead, starvation of longer processes

Preemptive: Process can be interrupted when a new process with shorter burst time arrives
code :

Practical 2
Round Robin (RR)
Main concept: Each process gets a small unit of CPU time (time quantum) in a circular
manner

Advantages: Fair allocation, good for time-sharing systems, no starvation

Disadvantages: Performance depends heavily on time quantum selection

Preemptive: Process is preempted after time quantum expires

Time quantum: Critical parameter that affects performance (too small: excessive context
switching, too large: degenerates to FCFS)

code :

Practical 3
Practical 4

You might also like