Homework | Task | Deadline | Points | Student Name: |
6 | CPU Scheduling Implementation | Tuesday Mar. 9 1998 | 20 |
Write a program in C or C++ that implements Shortest Job First and Priority CPU scheduling algorithms. Compare the algorithm by estimating the waiting time, turnaround time, the number of context switch and the average of each item. Assume using preemptive scheduling and the two algorithms will be used separately.
Input Requirement:
(1) Your program should be able to read input from a file.
(2) The name of the input file should be "data".
(3) The format of the input file is given below.
P1 0 15 2 Note : First column - Process number P2 10 28 1 Second column - Arrival time P3 14 7 4 Third column - Burst length P4 25 32 3 Forth column - Priority P5 43 18 5
Output Requirement:
(1) Output the Gantt chart of these two scheduling algorithms.
The Gantt chart should be look like the following:
Time : 0 1 2 3 4 5 6 .........
Process Id : P0 P1 P1 P1 P2 P2 P3 .........
(2) Output the results of the comparison of the two algorithms in a tabular form as given below:
SHORTEST JOB FIRST ALGORITHM
P1 P2 P3 P4 P5
waiting time
turnaround time
context switches
PRIORITY ALGORITHM
P1 P2 P3 P4 P5
waiting time
turnaround time
context switches
Note:
(1) Please make sure your input file name is "data" and
your program can run under "megahertz" or
"afs".
(2) You should put all your source code in one file and send it
as an attatchment (disk is not acceptable).
(3) You need to submit your program by electronic mail to cis332fk@cis.njit.edu no
later than Midnight on Mar. 9, 1999
(4) You also need to submit a hardcopy of your program and the
input, output of one example.