Question: Write a Java program to simulate following CPU scheduling algorithms: 1) First Come First Serve (FCFS) 2) Shortest Job First (SJF) 3) Preemptive Priority Scheduling
Write a Java program to simulate following CPU scheduling algorithms: 1) First Come First Serve (FCFS) 2) Shortest Job First (SJF) 3) Preemptive Priority Scheduling 4) Round Robin (RR)
The task information will be read from an input file (input.txt) with the following format: Pid Arrival_Time Burst_Time Priority
All of fields are integer type where
Pid is a unique numeric process ID
Arrival_Time is the time when the task arrives in the unit of milliseconds
Burst_Time is the CPU time requested by a task, in the unit of milliseconds
Priority is the priority associated with each task with low numbers representing high priority.
Note: for RR algorithm you need to define a Time_quantum.
Create a simple user interface to ask user for input.txt file, a scheduling algorithm and Time_quantum if RR is chosen.
1.Print progress of task every unit time (millisecond).
2.Once all tasks are completed, the program should compute and print: Average waiting time, Average response time, Average turnaround time, and CPU utilization rate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
