42 direct mapped caches caches are grouped into

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: you why programs with good locality typically run faster than programs with poor locality. Nonetheless, knowing how to glance at a source code and getting a high-level feel for the locality in the program is a useful and important skill for a programmer to master. Practice Problem 6.4: Permute the loops in the following function so that it scans the three-dimensional array with a stride-1 reference pattern. 1 2 3 4 5 6 7 8 9 10 11 12 13 int sumarray3d(int a[N][N][N]) { int i, j, k, sum = 0; for (i = 0; i < N; i++) { for (j = 0; j < N; j++) { for (k = 0; k < N; k++) { sum += a[k][i][j]; } } } return sum; } Practice Problem 6.5: The three functions in Figure 6.20 perform the same operation with varying degrees of spatial locality. Rank-order the functions with respect to the spatial locality enjoyed by each. Explain how you arrived at your ranking. 6.3 The Memory Hierarchy Sections 6.1 and 6.2 described some fundamental and enduring properties of storage technology and computer software: ¯ ¯ Differ...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online