EECS 371 - Operating Systems

Assignment  2

Due: February 15, 2001, Turnin will be left on until at least 11:59 pm on Firday 2/16/2001.

 

For this assignment, we will modify the first assignment to allow for different scheduling algorithms for the three different types of queues:  the Long-Term scheduler, the Short-Term scheduler and the I/O schedulers.  The algorithms for the long-term scheduler will be Balance-I/O and Smallest-Job-First.  The algorithms for the short-term scheduler will be Shortest-Job-First, Predict-Shortest-Job-First, Round-Robin (quantum = 5) and Round-Robin (quantum = 12).  The algorithm for the I/O schedulers will be First-Come-First-Serve. 

 

Each student will only have to write a program for a single set of algorithms.  The algorithms used will be based on the first letter of your EECS User ID.  Refer to the following table to determine which algorithms you must use.  Note:  the First-Come-First-Serve algorithm is used for all the I/O schedulers.

 

First Letter of EECS

User ID

Long-Term Scheduler

Short-Term Scheduler

A-F

Smallest-Job-First

Shortest-Job-First

G-I

Smallest-Job-First

Predict-Shortest-Job-First

J

Smallest-Job-First

Round-Robin(q=12)

K-L

Smallest-Job-First

Round-Robin(q=5)

M

Balance-I/O

Shortest-Job-First

N-P

Balance-I/O

Predict-Shortest-Job-First

R-S

Balance-I/O

Round-Robin(q=12)

T-Z

Balance-I/O

Round-Robin(q=5)

 

The Balance-I/O algorithm for the long-term scheduler will select a process based on which I/O device it will use.  The algorithm attempts to maintain an even usage (or balance) of the three I/O devices.  When processes are waiting, the algorithm selects the process that will use the least busy I/O device.  The "busyness" of an I/O device is determined by the number of processes currently using that device.  If no process is waiting for the least busy I/O device, then select a process waiting for the second least busy I/O device (if no process if waiting for this device, select for the most busy I/O device).  If there is a tie in the "business" of the I/O devices, first select for the lower numbered device (i.e. select a process for device 1 over devices 2 or 3, and device 2 over device 3).  The processes for a particular I/O device are to be selected in the order they arrive.

 

The Smallest-Job-First algorithm for the long-term scheduler will select the process that requires the smallest amount of memory. 

 

The Shortest-Job-First algorithm for the short-term scheduler will select the process with the smallest next CPU burst size (this will give us the theoretical shortest wait time). 

 

The Predict-Shortest-Job-First algorithm for the short-term scheduler will select the process with the smallest result from the following equation:

 

            Tn+1 =  0.5 * Tn + 0.5 * tn      Where:           Tn+1 is the current prediction

                                                                                    Tn is the last prediction

                                                                                    tn is the last actual CPU burst

                                                                                    T0 is set to 4

 

The Round-Robin algorithms for the short-term scheduler are the only  preemptive algorithms that will be used.  These algorithms will return the process to the CPU waiting queue if the process has not completed by end of the time quantum.  The time quantum will be either 5 milliseconds or 12 milliseconds. Note: time quantum is the same as time slice.

 

One other change will be that the name of the data file is to be given as a command line argument instead of using the hardcoded name of mp1.data.  For command line arguments, your main() function will take two parameters.  These parameters are most often called argc and argv.

 

The remainder of the program will be exactly the same as what was required for the first machine problem.

 

The assignment is expected to be the result of individual work.  You will submit the project electronically using the UNIX "turnin" command with the project name of mp2.  As shown below, where <files> is a list of all files that you wish to submit.  Refer to the man page on the system for more information about the command.

 

            $> turnin -c eecs371 -p mp2 <files>

 

All of your programs must be written in a good programming style. This is to include in-line comments, a file header, function headers, blank lines, indentation, meaningful variable names, readable output, etc.  The first two lines of your file must comments stating how you compiled your program on the EECS department's UNIX machines and how you ran your program.  You must also submit a makefile with your program that will properly compile your program.