Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started