![]() |
Shortest Job First (SJF) scheduling is a non-preemptive CPU scheduling algorithm where the process with the smallest burst time is selected for execution from the ready queue. The objective is to minimize the average waiting time of processes. Example 1: Consider the following processes with their burst times:
Output: Average Waiting Time: 7.0
Example 2: Consider another set of processes:
Output: Average Waiting Time: 3.25
Shortest Job First (SJF) Scheduling AlgorithmSort the processes based on their burst time in ascending order.
Implementation of Shortest Job First (SJF) Scheduling in Python:
Output Process ID Burst Time Waiting Time 4 3 0 1 6 0 3 7 3 2 8 12 Average Waiting Time: 7.0 Complexity Analysis:
|
Reffered: https://www.geeksforgeeks.org
DSA |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 20 |