Introduction
Simulation is a powerful tool that can be employed when designing and selecting scheduling algorithms for an operating system. In this project you will implement and perform simulations to compare the scheduling algorithms from two popular flavors of unix: Linux and BSD Unix 4.4.
Assignment
Compare the performance of the credit based time sharing algorithm used by Linux to schedule processes in its OTHER queue to the multilevel feedback queue algorithm used by BSD unix 4.4. Implement these algorithms so that they work as they were described in class.
You will complete this project in 4 phases:
More details on each of these phases is provided below.
Project Proposal
Your project proposal must describe and justify the simulations you intend to perform and metrics you intend to use to make performance comparisons between the Linux and BSD schedulers. Be sure to include experiments and metrics that compare how these schedulers behave for collections of I/O bound processes, collections of CPU bound processes and various mixes of CPU and I/O bound processes. You should also consider process mixes designed to evoke the best and worst performance from each of the algorithms. I anticipate that good proposals will be 1 to 2 double spaced, type written pages. I will read and return your proposals with comments that you should ultimately integrate into your project. If necessary you may be asked to revise and resubmit your project proposal.
Simulation Development
You will be implementing the Linux and BSD schedulers using the simulation framework provided below. This simulation framework accepts as input a specification of a collection of processes. The framework then simulates the system calls and interrupts that an OS kernel would receive when executing the specified processes. The following sub-sections provide an overview of the simulation framework.
Downloading the Simulator
In order to execute the simulator you will need to download each of the following Java files:
You should also download the following data files to help you get started:
Compiling the Simulator
To compile the simulator use the command:
Running the Simulator
The general form of the command line to run the simulator is:
The command line parameters have the following effects:
<processes file>
processes.dat contains two (non-comment) lines indicating that the processes in the files process1.dat and process2.dat should be executed by the simulator. Lines beginning with # are comments and blank lines are ignored. The format of the files for each process is described below.
<device file>
devices.dat contains lines indicating three I/O devices and two Queue devices. Each (non-comment) line in this file specifies one device. Such a line must begin with either I/O or Queue to indicate the type of device and must conclude with the name of the device. Device names may not contain spaces. Lines beginning with # are comments and blank lines are ignored.
<scheduler type>
To run the simulator with the datafiles downloaded above use the command line:
If you successfully downloaded and compiled all of the above files the output of the program will appear as:
This output indicates that the execution of the processes listed in the processes.dat file required a total of 385 time units. 30 of those time units were spend performing kernel operations, 300 were spent performing user operations and for 55 time units there were no runnable user processes and the Idle process was executed.
The Process Data Files
Each file listed in the file specified by the <processes file> command line parameter describes a single process to be executed on during the simulation. The syntax of these process data files is documented in the process1.dat file which appears below. Lines beginning with # are comments and blank lines are ignored.
This process1.dat file describes a process named PROCESS1. Each process in a simulation must have a unique name. PROCESSS1 arrives in the system at time 0. This means that the system call for creating PROCESS1 will occur at time 0. PROCESS1 then goes on to have a CPU burst of 100 time units, followed by an I/O burst on DISK1 of 100 time units, followed by a final CPU burst of 100 time units. PROCESS1 is an example of a very simple process. It is likely that you will use several simple processes such as this to verify that your scheduling algorithms are working correctly. For example, I used the process1.dat and process2.dat processes that you downloaded when testing the simple FCFS scheduler. However, when performing the comparisons of your scheduling algorithms it is likely that you will want significantly more complex and lengthy processes.
The Kernel Class
All of the programming that you will need to do for this project will take place in the Kernel class. The Kernel class that is provided implements a simple FCFS scheduling algorithm and is capable of supporting only a single I/O device. You will need to modify this Kernel to implement the Linux and BSD schedulers and also to handle multiple I/O devices and Queues.
The methods in the Kernel are called by the the SystemDriver and other classes provided above. These other classes read the device and process data files and make calls to methods in the Kernel class to simulate the system calls and interrupts that would occur when executing the processes. The Kernel class contains one constructor and four methods that are used by the SystemDriver and the other classes. The purpose and use of each of those methods is discussed below:
public void systemCall(int callID, String param)
systemCall method will be invoked when the system requires the services of the kernel. More specifically the systemCall method is invoked under three different circumstances:
SystemDriver invokes the systemCall once for each device or queue listed in the <devices file>. These system calls are indicated by callIDs of MAKE_DEVICE and MAKE_QUEUE. The kernel must respond to these system calls by creating a waiting queue for the device or queue. The param will contain the name of the device or queue as it was indicated in the <devices file>.
callID of START_PROCESS. The param will contain the name of the new process as was indicated in the process' data file. The kernel must respond to this system call by creating a new PCB for the process and adding the new PCB to the appropriate location in the ready queue.
systemCall method will be invoked with the appropriate callID and param. When a process makes an I/O request (IO_REQUEST) or a request to wait on a Queue (WAIT), the PCB for that process must be moved to the end of the waiting queue associated with the I/O Device or the Queue. For simplicity, the waiting queues for both the I/O devices and the Queues should be FIFO queues. When a process notifies a Queue (NOTIFY) the process that has been waiting on that Queue the longest should be moved to the appropriate location in the ready queue. When a process notifies all processes in a Queue (NOTIFY_ALL) all processes waiting on that Queue should be moved to the appropriate locations in the ready queue. Finally, when a process exits (TERMINATE_PROCESSits PCB should be removed from the system.
The following table summarizes all of the callID and param values that may be passed to the systemCall method:
public void interrupt(String deviceId)
interrupt method is invoked under two conditions:
interrupt method is invoked with the deviceId parameter set to the name of the device that generated the interrupt. The kernel must remove the PCB from the head of the device's waiting queue and move it to the appropriate location in the ready queue.
deviceID will be set to the string TIMER. The kernel should use these interrupts to implement the Linux and BSD scheduling algorithms.
public String running()
running method must return the name of the process that is currently in the running state. If no process is currently ready to run this method should return the string "Idle" indicating that the CPU is idle. This information is used by the simulator to credit execution time to the correct process.
public void terminate()
terminate method is called automatically when all of the processes in the simulation have completed. The kernel should use the terminate method to calculate and report the statistics necessary for comparing scheduling algorithms.
You may add additional methods to the Kernel class for your own use. However, the methods described above must exist and must perform the indicated operations.
The SystemTimer Class
When the Kernel is constructed it is passed a reference to an object of type SystemTimer. This object contains four public methods that will be useful for computing the statistics you will need to compare your scheduling algorithms. These methods are:
getSystemTime()
getKernelTime()
getUserTime()
getIdleTime()
Paper Submissions
The paper for this project will be in the form of a scientific journal article. Your paper should be divided into 5 sections as follows:
If you would like to see an example of a paper in this format, here is a paper that I have written: "Investigating Chaos as a Source of Innovation in a Simple Model of a Co-Evolutionary System" in pdf format.
Paper Revisions
Details of the revisions that are necessary will be provided when the draft of your paper is returned.