You will implement a program to show the performance of the FCFS scheduling algorithm with I/O burst.
Question:
You will implement a program to show the performance of the FCFS scheduling algorithm with I/O burst. Your program should get a file (e.g., “jobs.txt”) as the command-line input, and read the contents of the file. This file contains a set of processes.
For example, consider the file with the following content:
1:(45,15);(16,20);(80,10);(40,-1)
2:(15,10);(60,15);(90,10);(85,20);(20,-1)
3:(30,15);(40,20);(5,15);(10,15);(15,-1)
In this example we have 3 processes, each process is represented in a separate line. The general format of a line is as follows:
:(< cpu-burst1, io-burst1>);(< cpu-burst2, io-burst2>);...(< cpu-bursti, io-bursti>)
The first token is the unique process id. After process-id you have a colon (:) delimiter. Then you will see a list of tuples separated by semicolons (;).
Each tuple in parentheses indicates the next cpu-burst and io-burst lengths of the process.
The cpu and io burst length in terms of milliseconds. If the last io-burst is -1, then it means that the process terminates without making an I/O.
Note that this input is just an example, I may use a different input file having a different content for testing your codes, but the format of the file will be same. ( Be careful on duplicate last line issue when reading from the input file)
You will assume that ;
o all the jobs arrive at the same time (t=0), the order of arrival is the same as the order of process-ids (i.e., smaller ids arrive earlier).
o the process never waits at the device queues and I/O starts immediately
First Come First Served (FCFS) Algorithm
Implement FCFS scheduling policy. You should print the following
a. Average turnaround time: The average of the turnaround times of all processes
b. Average waiting time: The average of the total waiting time for all processes.