When the requested block nally arrives from memory

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: ent storage technologies have widely different access times. Faster technologies cost more per byte than slower ones and have less capacity. The gap between CPU and main memory speed is widening. Well-written programs tend to exhibit good locality. 6.3. THE MEMORY HIERARCHY 299 1 2 3 4 5 6 7 8 #define N 1000 typedef struct { int vel[3]; int acc[3]; } point; point p[N]; 1 2 3 4 5 6 7 8 9 10 11 void clear1(point *p, int n) { int i, j; for (i = 0; i < n; i++) { for (j = 0; j < 3; j++) p[i].vel[j] = 0; for (j = 0; j < 3; j++) p[i].acc[j] = 0; } } (a) An array of structs. 1 2 3 4 5 6 7 8 9 10 11 (b) The clear1 function. 1 2 3 4 5 6 7 8 9 10 11 void clear2(point *p, int n) { int i, j; for (i = 0; i < n; i++) { for (j = 0; j < 3; j++) { p[i].vel[j] = 0; p[i].acc[j] = 0; } } } void clear3(point *p, int n) { int i, j; for (j = 0; j < 3; j++) { for (i = 0; i < n; i++) p[i].vel[j] = 0; for (i = 0; i < n; i++) p[i].acc[j] = 0; } } (a) The clear2 function. (b) The clear3 function. Figure 6.20: Code examples for Practice Problem 6.5. 300 CHAPTER 6. THE ME...
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