Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Java is the required language for this problem:image text in transcribed

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

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

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions