Mini Project: The Art of Computer Science Measurement
Due Date: Thursday, February 9th, by midnightOverview
In this assignment, you will get your feet just a little bit wet with a computer system. One of the most important parts of computer systems is evaluation. Hence, understanding what it takes to perform such an evaluation is a skill we wish to develop.
What you're going to do:
First, you have to pick a platform to study. Any Unix-based system
(such as a PC running some version of Linux) is acceptable. For this
assignment, please no Windows-based systems, unless you also do some
Unix-based system in addition. Second, you're going to run some simple
experiments, which you design to bring out various properties of the
file system under test. Third, you are going to create some graphs to
demonstrate those properties -- call them "empirical proofs". Finally,
you will write up what you did.
You are to work alone on this project.
Talking to your friends at some level is OK, but this should primarily
be an exercise for you. Part of the process is to develop some
measurement skills now for later use in your final project, so do a
good job here and it will pay off down the road.
More Detail
In this assignment, we're going to explore the inner-workings of the file system. In a Unix-based file system, assume we have the following system calls to work with: open(), close(), read(), write(), lseek(), and fsync(). If you don't know what those system calls do, then use the man pages to find out.
Our main approach is going to be to write little code snippets that
exercise the file system in different ways; then, by measuring
how long various operations take, we are going to try to make some
deductions about what the file system is doing.
Step 0: Platform
Pick a platform you will work upon. Very likely it will be something like a PC running Linux, but please feel free to be adventurous -- it will keep my eyes open when reading your project on a system that is a bit different, e.g., FreeBSD, some ugly old Unix system like AIX, or even Mac OS X. However, please do use a Unix-based system.Do a little research on the file system. Some systems, such as MacOS HFS and Linux XFS, use extents in the inode instead of blocks. The file system layout may determine some of your experiments.
Step 1: Timers
The accuracy and granularity of the timer you use will often have a large affect on your measurements. Therefore, you should use the best timer available. Fortunately, on x86 platforms, a highly accurate cycle counter is available. The instruction to use it is known as rdtsc, and it returns a 64-bit cycle count. By knowing the cycle time, one can easily convert the result of rdtsc into a useful time. Other platforms have similar highly-accurate timers available - use them!
Hence, the first thing you should do is: figure out how to use rdtsc
or its analogue (you can use google to find out more about it). Once
you know how to call it and get a cycle count, convert the result to
seconds and measure how long something takes (e.g., a program that
calls sleep(10) and exits should run for about 10 seconds. Confirm
your results make sense by comparing it to a less accurate but
reliable counter such as gettimeofday. Note that
confirmation of timer accuracy is hugely important! If you don't
trust your timer, how can you trust the results of your
measurements?
Step 2: Measuring the File System
After getting our timer in order, we will move on and measure some aspects of the file system proper. All measurements should be done on the local disk of some machine - do not measure the performance of a distributed file system such as AFS, where, for example, your CS account resides. If you aren't using your own machine, you might consider the Crash and Burn lab or just one of the other computer labs in the building.
Through experiments that you design, implement, run, and measure, you
are to answer the following questions:
How big is the block size used by the file system to read data? Hint: use reads of varying sizes and plot the time it takes to do such reads. Also, be wary of prefetching effects that often kick in during sequential reads.
During a sequential read of a large file, how much data is prefetched by the file system? Hint: time each read and plot the time per read.
How big is the file cache? Hint: Repeated reads to a group blocks that fit in cache will be very fast; repeated reads to a group of blocks that don't fit in cache will be slow.
How many direct pointers are in the inode? Hint: think about using write() and fsync() to answer this question. Also think about what happens when you extend a file and suddenly an indirect pointer must be allocated -- how many more writes occur at that point?Hence, in your write-up, you should have one or more graphs which you use to directly answer the questions above. Be critical of yourself -- are the conclusions you draw foolproof? Or are they mere hypotheses?
A major issue with any data collection is: how convincing are your
numbers? How do you make them more convincing? How do you deal with
experimental noise? etc. Use your common sense and be critical of your
numbers -- do they really convince you that you know the answer?
One thing you will undoubtedly do is to use repetition to
increase your confidence, i.e., you will take multiple measurements of
an event, and compute (for example) an average over many runs instead
of the result from just a single experiment. Be careful when computing
averages over numbers -- make sure to always first look at all the
data.
If you don't, you might use an average where an average doesn't make
sense.
Step 3: Writing It Up
After you're done with experiments, you'll need to write up what you've done. What should go in your writeup? Here are some tips:Title: The title should be descriptive and fit in one line across the page.
Author: Right under the title, this says who you are.
Abstract: This is the paper in brief and should state the basic contents and conclusions of the paper. The abstract is not the introduction to the paper (it should be shorter), but is a summary of everything. Read some of the abstracts of papers we've read for class to get a better idea. In general, the abstract is an advertisement that should draw the reader into your paper, without being misleading. It should be complete enough to understand what will be covered in the paper. This is a technical paper and not a mystery novel -- don't be afraid of giving away the ending!
Intro: A short overview of what you did, and what you learned. More motivation than the abstract, and more details. Again, make sure you include your main conclusions.
Methodology: How you measured what you measured. Include something about your timer accuracy here, as well as a description of the platform you are using to the level of detail such that someone else could reproduce the experiment elsewhere.
Results: This section should consist mainly of graphs, addressing each of the questions above. Make sure that graphs have axes labeled (including units). Also make sure to include the code snippets with each graph (or some rough description of them) so we have an idea what exactly you measured. Also, make sure to draw appropriate conclusions about each graph.
Conclusions: Summarize your conclusions here, and talk about what else you have learned in the process.This paper should be at most 6 pages long (including everything), in 10 point or larger font, in double column format. In your write-up, you should not re-describe the assignment. Your paper must be written using proper English grammar and should have no spelling mistakes.
Here are hints on the writeup:
- When proposing experiments, describe your hypothesis: how does the system work, how do you expose that behavior. Make a prediction on what should happen if your hypothesis is correct.
- Don't use passive voice. E.g. the inode is read from disk. Say the FS reads the inode from disk.
- When describing experiments, discuss the relevant details of the platform, uch as processor type and speed, memory size, OS name and kernel version.
- When graphing, change the scale to highlight the useful stuff. If nothing happens at the bottom, chop it off.
- Perform multiple runs to make sure the data is good. Depending on the test, you might want best case, average case, median case, or worst case. Understand why. When looking for phenomena, best case may work well. If using randomness, you may want the median or average case.
- If you have data anomalies, explain why they occur. For example, if there is a sudden spike or downturn in graph, explain why
- Read your paper through completely before handing it in. Spell check it as well (aspell and ispell are good programs to use with LaTex).
- When including code fragments, only include the relevant code. For example, you can leave out most arithmetic or bookkeeping code that is not relevant to the computation.
LaTeX Use this for typesetting your document.
gnuplot Use this for making graphs.Check out ~swift/public/latex-example/ for an example of how to use these tools (run "make pdf" to produce the file main.pdf from main.tex). LaTeX is an excellent system for writing academic/scientific papers with, and it is worth spending some amount of time learning how to use it. Using gnuplot or something like it (e.g., Ploticus ) also makes a lot of sense as these tools produce nice encapsulated postscript (eps) files to use within LaTeX. epstopdf can convert these to pdf for generating pdf files from latex directly.
You can use Microsoft Excel as well, but you need to print the graph as pdf and then crop it to use in the paper.