Homework Assignment 3

In this exercise you will study the effect of several parameters used with Round-Robin (RR) scheduling. You must write a discrete simulation to study the performance of this strategy under different time slice lengths and different context switching times. Do this by writing a simulation program to imitate the behavior of a single-CPU system that has a pre-emptive RR scheduler.

Create an input file to represent process arrival and service times, where each line represents a process arriving into your simulated system. The first number is the arrival time (in integer seconds), and the second number is the amount of time the process requires to complete (in floating-point seconds). For example, the first several lines of the file might look like:

	 30	 0.783560
	 54	17.282004
	 97	32.814522
	133	39.986730
	163	42.805902
	181	28.249353
	204	45.561030
	249	26.369485
	287	48.582049
	325	37.274777
	365	37.144992
	399	33.059136
	424	47.168534
	455	20.090157
	488	56.053016
	531	39.640908
	572	 0.717403
	610	34.732701
	637	21.593761
	658	48.477451
	685	21.472914
	729	44.603773
	...
	...
	...

This means that the first process arrives at time 30 and requests 0.783560 seconds of CPU time; the second at time 54; and so on. Run the simulation using context switching times of 0, 5, 10, 15, 20, and 25 milliseconds and time quanta of 50, 100, 250, and 500 milliseconds.

In your simulation, assume the model shown below. Using at least the data given previously, determine the average wait time and the average turnaround time for all processes. Plot your findings in two graphs. In the first graph, the Y-axis should be the average wait time and the X-axis should be the context-switching time. You will have one curve on the graph for each time quantum you test. The second graph is the same as the first except that you should plot the average turn-around time for the processes. Report the fraction of time the processor is busy for each simulation run.