April 14 at the start of class.
We have written a program that simulates a short-term scheduler; with this program, you can experiment with various scheduling policies. Your assignment is to implement the Lottery scheduling policy, and compare it with the round-robin scheduling policy by running experiments.
The current version of the program simulates (non-preemptive) Round-Robin (RR) scheduling, but it is constructed to allow easy modification for other scheduling policies. The program expects the following command line:
java Proj3 [-v...] [-t] data-file quantum
The Simulator essentially consists of Jobs, Devices, and Schedulers -- all coordinated by a single loop of code. A Job is a customer of services: it is a process that needs to use system resources during its execution. A Device represents a resource in the system. In this simulation, the devices available to a job are the CPU and the disk. There is also a clock device and a pseudo-device that interrupts whenever a new job arrives in the system. A Scheduler coordinates access to a device. It queues Jobs that are waiting to use a device and will choose which job is the next to access.
The overall execution of the simulator occurs like this: Jobs arrive at the JobArrival device and are entered into the system. A job's lifetime consists of alternating periods of using the CPU (called a burst) and performing I/O. The Main Loop is responsible for moving jobs around the system. It sends them to a scheduler, takes the next job from a scheduler, and starts and stops jobs running on a device. The Disk Scheduler and the CPU Scheduler decide which job should be the next to run on their respective devices. They also buffer jobs that are waiting to run but have not yet been given access. The clock device is used to enable preemption (more on this later).
For those who would like a more detailed description of the system (more than is necessary to do this assignment) there are pages describing all the interfaces in detail, additional documentation about the program, and, of course, comments in the code itself.
For this project, you focus on the CPU Scheduler object shown above. The provided simulator performs Round-Robin (RR) scheduling. You are to create a different version of the simulator to implement the Lottery Scheduling policy described below.
You should have two versions of the simulation program when finished,
~cs537-2/public/project3They include all of the files for the simulator, several data files, and a Makefile. Copy all of these files into one of your directories and type make to run the Round-Robin version of the simulator.
The easiest way to work on this assignment is to modify a copy of the provided Round-Robin scheduler.
cp RRScheduler.java LotScheduler.javaDon't forget to change all occurrences of RRScheduler to LotScheduler in the copy and in Makefile.
You should also change the line cpuScheduler = new RRScheduler(); in the file Sim.java to read cpuScheduler = new LotScheduler();. The methods in RRScheduler which you will have to modify for your assignment include:
You need to compare the performance of two scheduling algorithms. You should also compare the performance for various values of the parameters quantum. Note that if quantum is very large, RR becomes First-Come-First-Served (FCFS).
You should approach this portion of the assignment as you would approach a laboratory assignment in a physics course. Use the ``scientific method.'' You should form some hypotheses before you start experimenting and use the experiments to confirm or reject these hypotheses based on observed results. Give careful thought to the correct choice of parameters for the programs. Try a few trial runs with various parameters, print out the results, and go home and think about the results. These preliminary results should help you decide on better parameters for a second round of trials. Remember: It's not the quantity but the quality of data that dictates the quality of the experiments.
If the program is not printing out all the statistics you would like to see, feel free to modify it to produce better output. You may find additional statistics-reporting code can help explain some of the behavior you observe.
You are to prepare a report describing the results of your experiments. Again, approach this report as you would approach a physics laboratory experiment report. You should carefully describe what experiments you did and what the results showed you about the different scheduling policies. We want to see a correlation between the experiments you run and the conclusions you draw. You must supply quantitative data to support your conclusions. The report should be not more than three typewritten pages, excluding tables, graphs, etc.
You grade will be determined as follows:
You must work in two-person groups for this project.
Copyright by Pei Cao and Marvin Solomon. All rights reserved.