Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write the code in java and use an input file please 2. This problem is to simulate scheduling CPU jobs by using a priority queue

image text in transcribed

write the code in java and use an input file please

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 and must process a sequence of commands, one per time slice, each of which is of the form "add name with length n and priority" or "no new job this slice" A command line user interface has to be provided as follows: "Enter your input file name:" "Display the input before:"*display the input integers following a statement/ "Display the output after the operation:"display the resulting output on the screen The program is to be submitted to the directory in "handin" *Provide a README file with specific instructions for compilation and execution for the grader to follow, and any notes you want to add

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions