Question
You You must use this template package schedulingos; import java.util.Comparator; import java.util.PriorityQueue; public class FCFS{ static PriorityQueue processQueue = new PriorityQueue(10, new Comparator() { public
You You must use this template package schedulingos; import java.util.Comparator; import java.util.PriorityQueue;
public class FCFS{ static PriorityQueue processQueue = new PriorityQueue(10, new Comparator() { public int compare(Process process1, Process process2) { return (int)(process1.getArrivalTime()-process2.getArrivalTime()); } }); static PriorityQueue readyQueue = new PriorityQueue(10, new Comparator() {
public int compare(Process process1, Process process2) { return (int)(process1.getArrivalTime()-process2.getArrivalTime()); } }); static GlobalTimer globalTimer = new GlobalTimer(0);
public static void main(String[] args) { processQueue.add(new Process(1,3,2,globalTimer)); processQueue.add(new Process(2,6,3,globalTimer)); processQueue.add(new Process(3,1,4,globalTimer)); processQueue.add(new Process(4,4,5,globalTimer)); while(globalTimer.time
// TASK: Write your code here // Print performance statistics }
public static boolean checkIfNewProcessArrived(){ // TASK: Write your code here // return True/False by comparing the earliest arrival time from process queue with the global time } public static void runProcessInCpu(){ // TASK: Write your code here // Retrieve a process that is ready to run and run it
} }
package schedulingos; import java.util.Comparator; import java.util.PriorityQueue; public class FCFS{ static PriorityQueueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started