Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCI 232 - Out Lab 1 (100 pts max) Due: 11pm, February 12, 2021 Overview: ANSWER MUST BE IN JAVA. In this lab, you will

CSCI 232 - Out Lab 1 (100 pts max)
Due: 11pm, February 12, 2021
Overview:
ANSWER MUST BE IN JAVA.
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:
e.g. a file might contain:
8 4 5 100
1 3 10 100
5 2 20 50
UPDATE: you can assume the jobs are sorted by arrival time.
(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 heap-based priority queue, rather than rely on a built-in data structure (note: you just need to implement insert and deleteMax).
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:
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.
Example: suppose a job arrives at time 10s with duration 10s, starts at time 15s and finishes at time 30s. Then the waiting time is 5s, and the execution time is 15s.
A Visual Example:
Your program should run from the command line:
java JobScheduler input.txt
Submission:
Submit on gradescope.com, using group submission using your MSU credentials prior to the due date/time (you may also submit in-person directly to your TA during lab). Submit your:
.java files
an input file that youve created to test the program (but not the big graph files)
the resulting output and any optional discussion about your solution
(can be one document).
CODE MUST BE ONLY IN JAVA. Languages like PYTHON, PYTHON2, or C are not accepted.

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions