Answered step by step
Verified Expert Solution
Question
1 Approved Answer
it should be write on java program with input file 2. This problem is to simulate scheduling CPU jobs by using a priority queue to
it should be write on java program with input file
2. This problem is to simulate scheduling CPU jobs by using a priority queue to be built. Your program to be written for the simulation should run in a loop, each iteration of which corresponds to a time slice for the CPU. Each job is assigned a priority, which is an integer between -10 (highest priority) and +10 (lowest priority), inclusive. From among all jobs waiting to be processed in a time slice, the CPU, the CPU must work on a job with highest priority. In this simulation, each job will also come with a length value, which is an integer between 1 and 100, inclusive, indicating the number of time slices that are needed to process this job. For simplicity, you may assume jobs cannot be interrupted-once it is scheduled on the CPU, a job runs for a number of time slices equal to its length. Your simulator must output the name of the job running on the CPU in each time slice as shown below.+ Input File format: Each line in the input file contains the details one single job delimited by "space". Read the entire file first and then process the priority queue algorithm on all the jobs. JobName priority lengthOfJob Example input file: Job114-9 25 Job345 2 66 Job234-10 5+ Job999 10 56+ Output File format: Output on the command line should display the job that is being executed for every timeslice along with the priority and the remaining time for that job. Job for time slice# 'n'-lebName priority RemainingLenghtofThelobe Example output File: For the same input example file as above, the output should will be as follows:+ Job for time slice# 1-lob234-10 5 Job for time slice# 2-Job234-10 4 Job for time slice# 3-Job234-10 3- Job for time slice# 4-Job2 34-10 2e Job for time slice# 5-Job2 34-10 1- Job for time slice# 6-Job! 14-9 25- Job for time slice# 7-lobi 14-9 24- Job for time slice# 8-Job!14-9 23- Job for time slice# 9-lobi 14-9 22- Job for time slice# 10-Job! 14-9 21- The output of all the time slices must be printed to the console. A command line user interface must be provided as follows: "Enter your input file nameStep 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