Computer system design is a game of trade-offs. No where is that more evident than in the memory hierarchy, an organization of several devices meant to provide excellent performance at a reasonable cost.
In this reading you’ll be introduced to the memory hierarchy, starting with the trends in device cost, speed, and size that drive the organization of this hierarchy. You’ll also explore two fundamental concepts of computer science: locality and caching.
Sections 6.1.4, 6.2 - 6.3 (pp. 602-614) from the course textbook.
Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.
The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.
These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.
The table below contains a sequence of memory address accesses, where the first row is the first access, the second row is the next access, and so forth. Complete the table by filling in yes/no as to whether each access is an example of spatial or temporal locality. You can assume that all accesses are 4 bytes (i.e. reading or writing an int
).
Address | Spatial? | Temporal? |
0 | ||
4 | ||
8 | ||
12 | ||
100 | ||
104 | ||
108 | ||
200 | ||
4 | ||
8 | ||
200 |
Complete the following C code such that the code has a stride-4 reference pattern.
int get_max(int *arr, int size) {
int max = 0;
for ( ) {
int tmp = arr[i];
if (tmp > max) max = tmp;
}
return max;
}
For each of these layers in the memory hierarchy, list the device for which it acts as a cache.