Class which implements the FCFS scheduling algorithm. More...
void addProcess (S id, T arrival, E burst) Adds the process to the ready queue if it isn't already there.template<typename S, typename T, typename E>
class FCFS< S, T, E >
Class which implements the FCFS scheduling algorithm.
Definition at line 98 of file fcfs_scheduling.cpp.
◆ addProcess()template<typename S, typename T, typename E>
void FCFS< S, T, E >::addProcess ( S id, T arrival, E burst ) inlineAdds the process to the ready queue if it isn't already there.
Definition at line 130 of file fcfs_scheduling.cpp.
130 {
131
132 if (idList.find(id) == idList.end()) {
136 idList.insert(id);
137 }
138 }
Class which implements the FCFS scheduling algorithm.
priority_queue< tuple< S, T, E, double, double, double >, vector< tuple< S, T, E, double, double, double > >, Compare< S, T, E > > schedule
◆ printResult()template<typename S, typename T, typename E>
void FCFS< S, T, E >::printResult ( ) inlineUtility function for printing the status of each process after execution.
Definition at line 192 of file fcfs_scheduling.cpp.
192 {
193 cout<<
"Status of all the proceses post completion is as follows:"195
200<<
"Waiting Time"<<
endl;
201
202 for(
size_t i{};
i< result.size();
i++) {
210 }
211 }
◆ scheduleForFcfs()template<typename S, typename T, typename E>
vector< tuple< S, T, E, double, double, double > > FCFS< S, T, E >::scheduleForFcfs ( ) inlineAlgorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algorithm.
FCFS is a non-preemptive algorithm in which the process which arrives first gets executed first. If two or more processes arrive together then the process with smaller process ID runs first (each process has a unique proces ID).
I used a min priority queue of tuples to accomplish this task. The processes are ordered by their arrival times. If arrival times of some processes are equal, then they are ordered by their process ID.
Definition at line 155 of file fcfs_scheduling.cpp.
155 {
156
158
161
162
163
166 }
167
168
170
171
172
174
175
177
178
180
181result.push_back(
cur);
183 }
184 return result;
185 }
◆ idList ◆ resulttemplate<typename S, typename T, typename E>
vector<tuple<S, T, E, double, double, double> > FCFS< S, T, E >::result privateDefinition at line 115 of file fcfs_scheduling.cpp.
◆ scheduletemplate<typename S, typename T, typename E>
priority_queue<tuple<S, T, E, double, double, double>, vector<tuple<S, T, E, double, double, double> >, Compare<S, T, E> > FCFS< S, T, E >::schedule privatePriority queue of schedules(stored as tuples) of processes. In each tuple 1st element: Process ID 2nd element: Arrival Time 3rd element: Burst time 4th element: Completion time 5th element: Turnaround time 6th element: Waiting time
Definition at line 112 of file fcfs_scheduling.cpp.
The documentation for this class was generated from the following file:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4