| Form groups: | Wednesday, October 8 at 11:59pm |
| Draft of Intro, Machine Description, and CPU Operations: | Wednesday, October 29 at 11:59pm |
| Draft of Memory Operations: | Friday, November 14 at 11:59pm |
| In-person check in: | Week 8 |
| Final report with all measurements and code: | Friday, December 5 at 11:59pm |
In building an operating system, it is important to be able to determine the performance characteristics of underlying hardware components (CPU, RAM, disk, network, etc.), and to understand how their performance influences or constrains operating system services. Likewise, in building an application, one should understand the performance of the underlying hardware and operating system, and how they relate to the user's subjective sense of that application's "responsiveness". While some of the relevant quantities can be found in specs and documentation, many must be determined experimentally. While some values may be used to predict others, the relationships between lower-level and higher-level performance are often subtle and non-obvious.
In this project, you will create, justify, and apply a set of experiments to a system to characterize and understand its performance. In addition, you will explore the relationships between some of these quantities. In doing so, you will study how to use benchmarks to usefully characterize a complex system. You should also gain an intuitive feel for the relative speeds of different basic operations, which is invaluable in identifying performance bottlenecks.
You have complete choice over the operating system and hardware platform for your measurements. You can use your own laptop, an operating system running in a virtual machine, a smartphone, a game system, or even a supercomputer. You can use a mainstream OS like Linux, MacOS, or Windows; a wide range of other Unix-based OSes (e.g., FreeBSD, NetBSD, OpenBSD, DragonFly BSD); or alternative OSes such as Fuschia, Haiku, or Plan 9/Inferno.
The project tasks originally had mainstream hardware platforms and operating systems in mind. But we also want to encourage you to do the project in more exotic platforms and environments. As a result, we can adapt the project tasks to the particular platform configuration you choose (e.g., if an unusual OS does not support a particular feature, such as a driver for your network card). Talk to us and we can adapt the project as needed.
You may work either alone or in 2–3 person groups. All groups do the same project, and all members receive the same grade. Note that working in groups may or may not make the project easier, depending on how the group interactions work out. If collaboration issues arise, contact your instructor as soon as possible: flexibility in dealing with such issues decreases as the deadline approaches.
This project has two aspects: you will implement and perform a series of experiments, and you will write a report documenting the methodology and results of your experiments. When you finish, you will submit your report as well as the code used to perform your experiments.
If you are measuring a system in an unusual environment (e.g., virtual machine, compute cloud, Web browser, etc.), estimate the degree of variability and error that might be introduced when performing your measurements.
cntvct_el0 register. You can
Google either of these to learn more about how to use them.
Note, though, that in the modern age
of power-efficient multicore processors, you will need to take
additional steps to reliably use the cycle counter to measure the
passage of time. You will want to disable dynamically adjusted CPU
frequency (the mechanism will depend on your platform) so that the
frequency at which the processor computes is determinstic and does not
vary. Use "nice" to boost your process priority. Restrict
your measurement programs to using a single core. See here for
more tips on measuring time.
For methodology examples see the "lmbench" and "hbench" papers listed below at the bottom of the project page. It is also important to keep in mind that measuring short execution sequences can be challenging since things like cache effects can skew the results; see the discussions in the lmbench (Sec 3.4) and hbench (Sec 2.1) papers for ways to reduce these effects, such as warming caches and manual loop unrolling.
Note that modern hardware prefetchers can detect sequential or strided access patterns and prefetch cache lines before they are accessed. Thus if you use the lmbench methodology directly, you will likely underestimate access latency, because cache line i+1 will be prefetched before the access to cache line i completes. You will need to adapt the methodology to ensure that prefetching cannot occur during your benchmark.
In the ideal case, you will not need to use information about the machine or the size of the L1, L2, etc., caches when implementing this experiment, and the experiment will reveal these sizes. However, modern CPU architectures are incredibly complex and have many optimizations in them that can lead to seemingly funky behavior (e.g., a fun exploration of why the value of the write (writing zeros) can lead to different performance).
With this in mind, your experiments may not reveal nice, sharp boundaries like the original lmbench paper. Do the best you can and, while the boundaries may not be crystal clear in your experiments, state in the report where your results do indicate different hardware regimes (L1 to L2 transition, etc.). In addition to the graph described above, summarize your results in a table that shows the access latency for each of the L1 cache, L2 cache, L3 cache, and main memory as well as the size of each of the caches.
mmap is one useful mechanism). How does it compare
to the latency of accessing a byte from main memory? Make sure
that your experiment triggers hard page faults rather than soft
page faults.
For the following operations, you will need a second machine. You can use two identical machines or use a different machine for your remote machine. Your report should mention which approach you took and describe the second machine if applicable.
Evaluate the operations above for the TCP protocol. For each quantity, compare both remote and loopback (localhost) interfaces. Comparing the remote and loopback results, what can you deduce about baseline network performance and the overhead of OS software? For both round trip time and bandwidth, how close to ideal hardware performance can you achieve? What are reasons why the TCP performance does not match ideal hardware performance (e.g., what are the pertinent overheads)?
/proc/sys/vm/drop_caches) or
specific files (e.g., see oflag=nocache with the
dd utility) from the command line. To flush
programmatically, see the posix_fadvise
system call. Report your results as a graph with a
log/log plot where the x-axis is the size of the file and the
y-axis is the average per-block read time.
Your report should have seven sections. This includes an introduction, a machine description, one section describing your experiments and results for each of the four operation categories described above, and a summary/conclusion section. We recommend formatting your report using one of the USENIX templates for conference papers or using this Overleaf template, which is set up with all the required sections. Make sure to leave time for writing your report; this often takes longer than students anticipate.
When writing your report, we recommend using the active voice (rather than passive) as much as possible. For example, we would prefer that you write "we used rdtsc to measure how long the operation took" rather than "rdtsc was used to meausure how long the operation took".
/proc
and /sys/devices/system/cpu on Linux, System Profiler on
Mac OS X, Device Manager on Windows,
sysctl on BSD, the cpuid x86 instruction). Gathering this
information should not require much work, but in explaining and
analyzing your results you will find these numbers useful. You should
report at least the following quantities:
If you are using an unusual platform, you may not be able to track down all of this information. In that case, just report "Unknown".
When reporting results, make sure to label each result with its units and to choose appropriate units for each operation (nanoseconds, microseconds, etc.). Report average results for a single operation (as well as the standard deviation) rather than a sum over many operations. Use a consistent amount of precision (e.g., 3 significant figures) throughout the report.
At the end of your report, summarize your results in a table for a complete overview. The columns in your table should include "Operation", "Base Hardware Performance", "Estimated Software Overhead", "Predicted Time", and "Measured Time". (Not required for the drafts.)
After submitting the second checkpoint (during week 8), each group will meet briefly with the TA to discuss how they have conducted their measurements so far. The TA will ask basic questions about how you implemented your measurements and analyzed your results in order to assess your understanding of your measurement methodologies and to ensure that all groups adhere to the academic integrity policies. The check in will be worth 10% of your overall project grade.
During the quarter you will have read a number of papers describing various system measurements, particularly in the second half of the quarter. You may find those papers on the reading list useful as references.
In addition, other papers you may find useful for help with system measurement are:
You may read the papers above, or other references, for strategies on performing measurements, but you may not examine code to copy or replicate the implementation of a measurement. For example, reading the lmbench paper is fine, but downloading and looking at the lmbench code violates the intent of the project.
In addition, you must implement all of your measurements yourself. You may not copy code from a student who is not in your group, download a tool to perform the measurements for you, or ask an AI tool to write your benchmarks.
You will submit two drafts of your project throughout the quarter as well as a final complete report at the end. For the first draft, you should cover the first two parts of the report (Introduction and Machine Description), and the first set of operations (CPU, Scheduling, and OS Services). For the second draft, incorporate the feedback you received on your first draft and extend your draft with results for the second set of operations (Memory).
The first and second drafts will each be worth 10% of your overall project grade. Why so little? The idea with the drafts is that they are primarily for your own benefit: they will get you started on the project early, and will give you a sense for how long it will take you to complete the project by the end of the quarter (in the past, students have reported that it has taken them 40-120 hours on the project). As a result, you should be able to better budget your time as the end of the quarter arrives. You should also update and add to the earlier sections of your report for the final report based on our feedback.
For the checkpoint drafts and the final report, submit them as PDF files to Gradescope. You must also commit your latest code to your team's GitHub repository before each deadline. Late submissions will not be accepted without prior approval from the instructor.
We will grade your project on the relative accuracy of your measurement results (disk reads performing faster than the buffer cache are a bad sign) as well as the quality of your report in terms of methodology description (can we understand what you did and why?), discussion of results (answering specific questions, discussing unexpected behavior), and the writing.
In the past, a frequent issue we have seen with project reports is that they do not clearly explain the reasoning behind the estimates, methodology, results, etc. As a result, we do not fully understand what the students did and why they did it that way. Be sure to explain your reasoning as well.
We will award up to 5% extra credit for projects that measure an unconventional platform or OS rather than a conventional laptop, desktop, or server running a mainstream OS. Example platforms that would earn extra credit include a game console, Raspberry Pi, WiFi router, or mobile phone. We will determine the amount of extra credit based on how challenging it is to conduct measurements on the platform you chose.
To summarize, the grading breakdown for the project is: