$20
1. [48 points] Write a Java program that will simulate First Come First Serve, Shortest Remaining Time, and Round Robin scheduling algorithms. For each algorithm, the program should compute the turnaround time and the waiting time of every job as well as the average turnaround time and average waiting time.The process information will be read from an input file. The format is as follows: Process_id,Arrival_time,CPU_time All fields are integers where: Process_id is a unique numeric process ID Arrival_time is the time when the process arrives in milliseconds CPU_time is the amount of estimated CPU time requested by the process All the fields will be delimited by a comma. An example of a sample input file is as follows: 1,0,8 2,1,4 3,2,9 4,3,5 The program will accept command line arguments. The program usage will be as follows: ./Question1 input_file [FCFS|SRT|RR] [time_quantum] where, Question1 is name of the java program and input_file is the input file containing the process information. FCFS refers to the First Come First Serve policy and is non-pre-emptive. SRT refers to Shortest Remaining Time and is pre-emptive. RR refers to Round Robin, which is pre-emptive and the time quantum only applies to this algorithm. Ignore context switching time. Note the last argument is only needed in case of Round Robin. Suppose you want to run the SRT algorithm on a process list contained in input file called process.txt, then you would run your program as follows: ./Question1 process.txt SRT If you want to run the RR algorithm on the same input file with a time quantum of 5 milliseconds, then you would run your program as follows: COMPSCI.215 Assignment 1 Semester I, 2013 2 ./Question1 process.txt RR 5 Turnaround time = completion time – arrival time Waiting time = Turnaround time – CPU time taken by the process When the program is run, it should print statistical information to the screen formatted in the following fashion: ============================================ Process ID | Turnaround time | Waiting time ============================================ | | ------------------------------------------------------------------------ | | ------------------------------------------------------------------------ …….. ============================================= Avg. | | ============================================= For example, if you run the program with RR scheduling using a time quantum of 4 milliseconds on process.txt, then the output to the screen should be as follows: ============================================ Process ID | Turnaround time | Waiting time ============================================ 1 | 20 |12 ------------------------------------------------------------------------ 2 |7 |3 ------------------------------------------------------------------------ 3 |24 |15 ------------------------------------------------------------------------ 4 |22 |17 ============================================= Avg. |18.25 |11.75 =============================================
IF IN NEED OF QUESTIONS 2-6 SOLUTION ALSO PLEASE INBOX ME