![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Implementation of SJF CPU scheduling algorithm. More...
#include <algorithm>#include <cassert>#include <iomanip>#include <iostream>#include <queue>#include <random>#include <unordered_set>#include <vector>Go to the source code of this file.
Classes | |
| class | Compare< S, T, E > |
| Comparator class for priority queue. More... | |
| class | SJF< S, T, E > |
| Class which implements the SJF scheduling algorithm. More... | |
Functions | |
| template<typename S, typename T, typename E> | |
| bool | sortcol (tuple< S, T, E > &t1, tuple< S, T, E > &t2) |
| Comparator function for sorting a vector. | |
| template<typename S, typename T, typename E> | |
| vector< tuple< S, T, E, double, double, double > > | get_final_status (vector< tuple< S, T, E > > input) |
| Computes the final status of processes after applying non-preemptive SJF scheduling. | |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| Main function. | |
Implementation of SJF CPU scheduling algorithm.
shortest job first (SJF), also known as shortest job next (SJN), is a scheduling policy that selects for execution the waiting process with the smallest execution time. SJN is a non-preemptive algorithm. Shortest remaining time is a preemptive variant of SJN. detailed description on SJF scheduling Author : Lakshmi Srikumar
Definition in file non_preemptive_sjf_scheduling.cpp.
| vector< tuple< S, T, E, double, double, double > > get_final_status | ( | vector< tuple< S, T, E > > | input | ) |
Computes the final status of processes after applying non-preemptive SJF scheduling.
| S | Data type of Process ID |
| T | Data type of Arrival time |
| E | Data type of Burst time |
| input | A vector of tuples containing Process ID, Arrival time, and Burst time |
Definition at line 228 of file non_preemptive_sjf_scheduling.cpp.
| int main | ( | void | ) |
Main function.
Definition at line 313 of file non_preemptive_sjf_scheduling.cpp.
| bool sortcol | ( | tuple< S, T, E > & | t1, |
| tuple< S, T, E > & | t2 ) |
Comparator function for sorting a vector.
| S | Data type of Process ID |
| T | Data type of Arrival time |
| E | Data type of Burst time |
| t1 | First tuple<S,T,E>t1 |
| t2 | Second tuple<S,T,E>t2 |
Definition at line 45 of file non_preemptive_sjf_scheduling.cpp.
|
static |
Self-test implementations.
Definition at line 267 of file non_preemptive_sjf_scheduling.cpp.