OS Shortest Job First

Shortest Job First ( SJF )

Shortest Job First (SJF) is an algorithm in which the process having the smallest execution time is chosen for the next execution. This scheduling method can be preemptive or non-preemptive. It significantly reduces the average waiting time for other processes awaiting execution. The full form of SJF is Shortest Job First.

There are basically two types of SJF methods:

  • Non-Preemptive SJF
  • Preemptive SJF

Q1. Write a C program to display the details of 2 processes given the process names, burst time of the processes and the arrival order of the processes. The process names are of type character, burst time and arrival time are of type integers.

Answer: Click Here

Q2. Write a C Program to compute the waiting time and turnaround time of 2 processes using SJF algorithm given the process names, their burst times and arrival times. Also compute and print the Gantt Chart, average waiting time and average turnaround time. The names of processes are of type character array,burst time and arrival time are of type integers.

Post a Comment