6.033 Hands-On Three -- Spring 2000

Due: February 24th

This assignment will help you understand some important concepts in time-sharing. It is based on this simple C program that runs the following loop n times, where n is an input parameter:

We ran this program four times on a time-shared computer.

  1. When the computer was unloaded without the -p option.
  2. When the computer was loaded, without the -p option.
  3. When the computer was unloaded, with the -p option.
  4. When the computer was loaded, with the -p option.

The loading was done by concurrently running a disk-intensive program (the UNIX "find" utility on a local file system, if you really want to know.) We then plotted the four graphs shown below. The graphs are not necessarily in the same order as the above-mentioned order of experiments.

Collecting your own data

Note: An earlier version of ts would crash with an error like "Segmentation Fault" under certain circumstances. There is now a new version of the program which should hopefully fix this problem. If you were having problems, please try this section again with the new version of the program.
You can find a copy of the source for ts at this link. Compile it with gcc:
athena% add gnu
athena% gcc -o ts ts.c
Run ts like this:
athena% ./ts [-p] number_of_iterations

Try running ps a few times on your own computer and see which results you will get. To save the results, pipe the output to a file, for example:

athena% ./ts [-p] number_of_iterations > ts-data

You'll want to use a graphing program such as gnuplot to view the results. For example,

athena% add gnu
athena% gnuplot
gnuplot> set xlabel "Sample number"
gnuplot> set ylabel "Iteration time (microseconds)"
gnuplot> set data style impulse
gnuplot> plot "ts-data" with lines
To set the range to make the graph more visible:
gnuplot> set yrange [0:1800]
gnuplot> plot "ts-data" with lines

You can direct gnuplot's output to a laser printer thus:

gnuplot> set term postscript monochrome
gnuplot> set output "| lpr"
gnuplot> plot ...
gnuplot> set output
gnuplot> set term x11

Answer the following questions.

  1. What would the graph of time-per-iteration vs. sample number look like if there were no other tasks running on the computer?

  2. Why don't any of the graphs look like the answer to 1?

  3. Would the answer to Q2 above be different if we had a computer 10 times faster? (These experiments were run on a 450 MHz i686 Linux PC.)

  4. Match the graphs with the four cases above, clearly explaining your reasoning (note that on graphs 2 and 4 the x axis are red, meaning there are values there, just very small).

  5. Run the program on your own computer and plot the output. Is your processor heavily loaded? Are the results like you expected?
    Now load your machine by running two processes as follows:
        athena%  (./ts 100000 >data1 & ; ./ts 100000 >data2 &)
        
    Plot data1 and data2 and explain what you are seeing.

  6. How long did this assignment take you?

What to turn in

Print out the answers to these questions, a copy of the graphs of the data you collected yourself (data1 and data2), and hand them in to your TA by February 24th.