we have a project due that involves reading in data from a file which is a 30x20 grid consisting of 30 processes each of which have 10 CPU bursts and IO bursts. From this we are supposed to implement FCFS, SJF, RR and a multi-level feedback queue in C++. From this we solve throughput, CPU utilization, Ave. turnaround time, etc. A process goes until an IO burst and then gives way to the next process. This is done til all 30 processes are complete. I completely understand the algorithms for each scheduler, and despite being horrible at coding could do this if the IO bursts werent involved.
My idea, and the one im currently implementing is to send all of the processes into a ready queue at time=0. Add the CPU burst of the first process to the system clock and then send this process into a waiting queue. Here it will wait until the system clock has the IO bursts amount of time added onto it from the next processes CPU burst. Then it will be popped and pushed back onto the ready queue. It's easy for me to say, unfortunately nowhere near that easy to code for me. Any ideas how to make this simpler? Or any FCFS code at all? i cant seem to keep track of all the variables for each process. Sorry if this is overlong or confusing sounding, its my first post ;)