M.I.T. DEPARTMENT OF EECS

6.033 - Computer System Engineering Handout 12 - February 29, 2000

Solutions to hands-on assignment #3

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

The graph should look completely flat. There should be no sudden spikes. If there were no other task running on the computer, the ts.c program would be able to compute all the time without being interrupted. If there are no interruptions, then the time between 2 iterations should be constant. The spikes are caused by the fact that there are other tasks, and once in a while, ts.c is put on pause so that the other tasks may execute.

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

On a modern computer there are always multiple tasks running simultaneously. Even if you are not multitasking, the operating system has system tasks that must execute and will interrupt your active program.

III. Would the answer to Q2 above be different if we had a computer 10 times faster?

Depends. In general, no, a faster computer will make each iteration run faster and thus lower the baseline on the graph, but there will still be other tasks that will run and spikes will still occur. However, if scheduling is based on time instead of cycles, as sufficiently fast computer could complete all 100k iterations of the loop before the scheduler preempts it.

IV. Match the graphs with the four cases above, clearly explaining your reasoning.

3.dat and 4.dat have much fewer spikes compared to 1.dat and 2.dat. Few spikes indicate there is only one primary task running. These are the graphs that show the system unloaded. The -p option means a system call to print to screen must be invoked each iteration. Print must be given a chance to update the montior and will cause frequent and periodic spikes. This is seen in 1.dat and 3.dat.

V. Run the program on your own computer and plot the output. Is your processor heavily loaded? Are the results like you expected?

This will depend on your machine and how loaded it is. Your graph should have some baseband and occasional spikes. More spikes if your system is more loaded.

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.

The 2 processes should have the same level of baseband. Each process will cause the other to have spikes (regular interleaved spikes). The system will also cause spikes (delays) that are less regular and that affect both processes.


Go to 6.033 Home Page Questions or Comments: 6.033-tas@mit.edu