Question: #include first _ come _ first _ served.hpp #include namespace cse 4 7 3 3 { void first _ come _ first _ served::run
#include "firstcomefirstserved.hpp
#include
namespace cse
void firstcomefirstserved::runstd::vector& processes
TODO:
For all processes
Get the arrival time
Get the burst time
If the arrival time is greater than the completion time
Set the completion time to the arrival time
Set the waiting time to the completion time minus the arrival time
Set the completion time to the completion time plus the burst time
Set the turnaround time to the completion time minus the arrival time
Add the burst time to the current time
void firstcomefirstserved::printresultsstd::vector& processes
std::cout FCFS Scheduling:" std::endl
Process IDtCompletion TimetBurst TimetArrival TimetWaiting TimetTurnaround Time" std::endl;
int totalwaiting ;
int totalturnaround ;
for const auto& item : processes
std::cout itemtostring std::endl;
totalwaiting itemgetwaitingtime;
totalturnaround itemgetturnaroundtime;
std::cout Average waiting time tics: totalwaiting processes.size std::endl;
std::cout Average turnaround time tics: totalturnaround processes.size std::endl std::endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
