Assignment #1: Warm-up Project

Due Date: 9/30/02

Notes

You are expected to do this assignment alone.

The TA (Matthew Allen) will be the "director" of the warm-up project. All questions should be directed to him via email (matthew@cs) or during his office hours (Mon at 2-3 and Thu at 3-4).

Read this assignment in its entirety before beginning!


Introduction

In this warm-up project you will be measuring the performance of various OS primitives. There are five goals for this project:

The Measurements

Your first step is to choose a version of the Unix operating system. You can choose any system that you have available to you (e.g., Solaris, Linux, AIX, Irix, HP-UX, NetBSD, FreeBSD). You are encouraged to select a platform that you will find interesting! You may either choose a machine that already has the OS installed, or you may install the OS on one of the machines in the crash-and-burn lab.

On this platform, you will measure several operating system features. In each experiment, you need to ensure that your measurements do not capture some anomalous behavior; therefore, to increase the confidence of your measurements, you should run each experiment multiple times within a loop and have your code report the average. While there are different ways you can determine the number of times your code must loop, the simplest is experimental. With this approach, you run each experiment manually, increasing the number of iterations each time, stopping when adding more iterations does not change the average.

Clock precision

The operating system and hardware provide various ways to measure time. In this first step, you need to identify two ways of measuring elapsed, real time (as opposed to accumulated process time) and determine the resolution (or precision) of the timer.

One way to determine the resolution of the timer is to read the clock value at the start and end of a simple loop. Start with a single loop iteration, then increase the iteration count of the loop until the difference between the before and after samples is greater than zero. Try to get the smallest non-zero positive difference. If a single iteration of a loop takes too much time, try putting simple statements between the two timer calls.

Repeat this test for each of the two ways that you measure elapsed time. Use the more precise way in the rest of your experiments.

Kernel call:

Choose a simple kernel call such as getpid() and measure the elapsed time to perform the call. Choose two other kernel calls that you suspect perform trivial operations, and measure the time to perform these. Be careful that some versions of these simple kernel calls may cache their result in a variable on the first call, making subsequent calls artificially fast (if so, then report both results). Also be sure that the platform actually performs a system call.

Context switch:

Measure the time to context switch between two processes.
Choose one of the following two techniques for measuring this time:

Page allocation:

Measure the latency of a page fault for a zero-filled page (i.e., a page fault in which the OS both allocates a free page frame and fills it with zero values). One way to measure the zero-filled page fault processing latency is the following: use malloc() to allocate a large region of memory, then touch one word out of each page in the region, and measure how long the whole operation takes. As reasonable, present your results such that you separate the cost of malloc from the time to touch each page. Explore this cost as a function of the number of pages, ensuring that your region is large enough to produce measurable results, but still fits in RAM.

File read:

Measure the time to read from a large file using two different techniques:

For both techniques, be sure to consider both files that are cached in RAM and on local disk. And, again, explore time as a function of the size of the read.

The Write-Up

The paper should be at most 6 pages (all inclusive), 10 point font, single-sided and 1-inch margins. In your write-up, you should not re-describe the assignment. Your paper must be written using correct English grammar and should have no spelling mistakes. The paper must contain the following parts:

Conclusions

Have fun with this assignment but be careful! Benchmarking is a subtle and tricky business. Things that look simple on first glance will often turn out to be quite intricate!