Simran 41721016 OS Program 3
Simran 41721016 OS Program 3
AIM: Write a program to implement Shortest Job First CPU Scheduling Policy.
The Shortest Job First (SJF) CPU scheduling policy is a non-preamptive scheduling algorithm
that selects the process with the smallest total burst time to execute next. It aims to
minimize the waiting time of processes and optimize CPU utilization by choosing the
shortest job available for execution.
In SJF scheduling, processes are ordered based on their burst times (time required for
execution), with the shortest jobs first. When a process arrives or completes its execution,
the scheduler selects the process with the smallest burst time from the ready queue.
Advantages:
• SJF scheduling minimizes the average waiting time, making it an efficient scheduling
algorithm in terms of response time.
• It provides better turnaround times for processes compared to many other
scheduling algorithms.
Disadvantages:
• SJF scheduling may lead to starvation, where longer processes never get a chance to
execute if a continuous stream of short jobs arrives.
• Predicting the exact burst time of processes in advance can be challenging, making
SJF less practical for some scenarios.
• It is a non-preamptive algorithm, which means that once a process starts executing,
it cannot be interrupted. Preamptive versions of SJF exist to address this limitation.
Conclusion: Shortest Job First CPU Scheduling Policy has been implemented through the
program and the output is attached.