Fall 2000

Lab 11: Cache

CS61C Patterson

Purpose:

By analyzing data gathered from real machines, you will learn the details on the behaviors for their caches. This week's lab has no real coding. You will NOT have to modify the given file cache.c. This lab is due on Thursday 11/9 or Friday 11/10 by your discussion session.

Task1:

Copy ~cs61c/lab8/cache.c into your lab directory. The program cache.c accesses increasingly large arrays and times how long these accesses take to determine characteristics of the memory hierarchy for the machine it runs on. Skim the code in cache.c. and answer the questions of the prelab. It should help you understand the big picture. The following is a breakdown of the code:

The output for this program is information for three topics of interest: Size, Stride, and read+write. Size refers to the size of the array (in bytes) you are testing with, NOT the size of the cache. You'll have to figure out the cache size for yourself. Stride refers to the how many bytes you are skipping for each access. For example, if the stride is 4, you will access bytes 0, 4, 8, 12, and so on from the array; skipping bytes 1, 2, 3, 5, 6, 7, 9, 10, 11, and so on. read+write refers to the amount of time needed to make the access to memory, in ns. You'll have to figure out for yourself whether these times denote hits or misses.

Task2:

Now, pick a machine. Run cache.c on the machine. Plot the experimental results( on separate sheet) with the elapsed time on the y-axis( round to nearest 100ns) and the memeory stride ( in bytes) on the x-axis. Label each line according to the size of the array accessed. ( you don't need to turn this in, but plot the graph and use it to answer questions ) Answer the following questions for each set of data:

Final Task:

Write up all your answers in a file called lab11.txt
Submit the file electronically by the time of your discussion session.
(only submit lab questions, prelab questions are to be done on paper and turned in during lab).

Last updated: 11/2 by Lan