Question: #include first _ come _ first _ served.hpp #include namespace cse 4 7 3 3 { void first _ come _ first _ served::run

#include "first_come_first_served.hpp"
#include
namespace cse4733{
void first_come_first_served::run(std::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 first_come_first_served::print_results(std::vector>& processes){
std::cout <<"FCFS Scheduling:" << std::endl
<<" Process ID\tCompletion Time\tBurst Time\tArrival Time\tWaiting Time\tTurnaround Time" << std::endl;
int total_waiting =0;
int total_turnaround =0;
for (const auto& item : processes){
std::cout <<""<< item->to_string()<< std::endl;
total_waiting += item->get_waiting_time();
total_turnaround += item->get_turnaround_time();
}
std::cout <<" Average waiting time (tics): "<< total_waiting / processes.size()<< std::endl;
std::cout <<" Average turnaround time (tics): "<< total_turnaround / processes.size()<< std::endl << std::endl;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!