Computer Organization Lab #8: Memory Caching

In this lab you will experiment with the memory cache on your procressor.

  1. Use the device manager tool on your Windows system to look up the precise processor your computer is using. Find the specifications for that processor on Intel's web site (a Google search on "PROCESSOR_NAME specification" will probably work). Take note of the size of the processor's memory cache.

  2. Write a program that creates (using malloc) a large array of unsigned integers and then increments every integer in that array repeatedly. Be sure to process the array in order from lowest index toward highest index. Use the Timer abstract data type to measure how long it takes to increment a single integer (loop over the entire array often enough to accumulate a reasonable amount of time and divide that time by the number of passes and the number of array elements).

  3. Repeat the experiment above for different array sizes ranging from about 0.5 times your cache size to about 1.5 times your cache size. Try at least seven different sizes, equally spaced. More sizes is better than fewer sizes... write an outer loop that takes care of this; you should be able to get all that results from a single run of your program.

  4. Produce a table of your results. What happens when you use an array larger than the cache? Although not required, if you are interested try using a spreadsheet program to create a graph of your results (average increment time vs array size).

Submit your final program to Moodle along with a table of your results and some comments about what it means. You can include the table and the comments in your program or you can submit two files zipped together.


Last Revised: 2017-04-27
© Copyright 2017 by Peter C. Chapin <PChapin@vtc.vsc.edu>