CS 3733 Operating Systems, Fall 1998 Assignment 2 Comments


Part 1

The thing to note here is that all of the processes have the same exponential CPU burst distribution and will generally have 20 or more bursts. A given process will wait a short time in the queue when its bursts are small and possibly a longer time when the bursts are large. This should average out and most of the processes should end up with about the same waiting time. This is illustrated by the small standard deviation of the waiting times, about 3 percent. Notice that the standard deviation the turnaround time is much larger, about 400 percent of the average. This is because of the large I/O burst time. The number of I/O bursts for one of these processes depends on the size of the CPU bursts so one of these processes with a lot of small CPU bursts will do a large amount of I/O.

Because the number of processes times the average CPU burst is smaller than the typical I/O burst, it will be rare that the ready queue will contain more than one process, as shown by the low CPU utilization and the small average waiting time which is less than half of the average total CPU time.

Part 2

This experiment compares 3 algorithms when run on processes which fall into two distinct groups, one with short CPU bursts and one with longer CPU bursts. All of the distributions are constant so this is completely deterministic.

Notice that the longer processes all arrive first and so one of these starts executing immediately. Under SJF, this one is allowed to finish its CPU burst of 100 and all of the short processes need to wait for this length of time. Under PSJF, this long-burst process is kicked out of the CPU which the short processes arrive and so the short processes only have to wait for each other. This is why PSJF has such a short waiting time compared to SJF.

The CPU utilization is almost the same (and fairly high) for all of the algorithms because the number of processes times the average CPU burst is about equal to the average I/O burst. Notice that FCFS has a slightly higher CPU utilization than SJF and FCFS. This is not because of the context switch time or the overhead of the algorithm, as the simulator does not take these into account. With SJF and PSJF, the shorter-burst processes finish early, leaving fewer processes to keep the CPU busy at the end of the run.

Part 3

There are many ways to perform experiments for this part and no one way is better than the rest. The important thing here is for you to understand the experiment that you did so that you correctly interpret the results.

In general, SJFA will work well (close to SJF) when the CPU bursts of a given process are all near each other. This allows the algorithm to predict the next burst based on the previous ones. If the bursts come from a distribution, there is no relationship between the various bursts and so SJFA will not do well. However, if the processes form two groups whose CPU bursts come from distributions with different means, SJFA can distinguish between these as long as these distributions have little overlap. This will allow the short bursts to be executed before the long ones, but will not be able to distinguish among processes with the same distribution.

Also, in order for SJFA to work well, each process needs to have a large number of CPU bursts. Since the initial approximation is always 0, it may take several bursts before SJFA can approximate the mean. The number of bursts needed will depend on alpha.

For the types of processes that can be used by this simulator, the value of alpha is usually not critical except for the extreme values of 0 and 1, and when the number of CPU bursts is small.


Common Mistakes