Java is the required language for this problem:
Overview: In this lab, you will write a program called JobScheduler, it should take a single input file as a command-line argument. Each line in the input file has the following format:
-arrival time (sec)> e.g. a file might contain: 1 3 10 100 5 2 20 50 8 45 100 (all values will be positive integers) These jobs might represent computer programs (or threads) that need to be run by the operating system Your task is to write a job scheduler that decides, for each second, what job should be run. The job that is available that has the highest priority value should be scheduled for the next second (ties can be broken arbitrarily). The central data structure to use a priority queue. You should implement your own priority queue, rather than rely on a built-in data structure Notes The list of jobs will first need to be sorted by arrival time The simulation begins at time 0 and runs until all jobs are finished At the beginning of each second 1. 2. Check if new jobs need to be added to the priority queue If the queue is non-empty, get the top priority job and run it for 1 second. If it finishes remove it, otherwise put it back in the queue Output: Your program should print out which job is running each second. You should also compute the waiting time and total execution time for each job. The waiting time is the time the job actually starts versus when it was first available. The total execution time is the number of seconds that it takes to finish the job once it begins (this will be greater than or equal to its duration). Some points will be awarded for nicely-formatted output. Overview: In this lab, you will write a program called JobScheduler, it should take a single input file as a command-line argument. Each line in the input file has the following format: -arrival time (sec)> e.g. a file might contain: 1 3 10 100 5 2 20 50 8 45 100 (all values will be positive integers) These jobs might represent computer programs (or threads) that need to be run by the operating system Your task is to write a job scheduler that decides, for each second, what job should be run. The job that is available that has the highest priority value should be scheduled for the next second (ties can be broken arbitrarily). The central data structure to use a priority queue. You should implement your own priority queue, rather than rely on a built-in data structure Notes The list of jobs will first need to be sorted by arrival time The simulation begins at time 0 and runs until all jobs are finished At the beginning of each second 1. 2. Check if new jobs need to be added to the priority queue If the queue is non-empty, get the top priority job and run it for 1 second. If it finishes remove it, otherwise put it back in the queue Output: Your program should print out which job is running each second. You should also compute the waiting time and total execution time for each job. The waiting time is the time the job actually starts versus when it was first available. The total execution time is the number of seconds that it takes to finish the job once it begins (this will be greater than or equal to its duration). Some points will be awarded for nicely-formatted output