Skip to main content\(\newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 11.3 Locallity
Checkpoint 11.3.1. Locality.
Accessing the same variable repeatedly is an example of what type of locality?
Spatial
Incorrect.
Temporal
Correct!
Both spatial and temporal
Incorrect
Neither spatial nor temporal
Incorrect.
Checkpoint 11.3.2. Locality.
Accessing values at two nearby indices in an array is an example of what type of locality?
Spatial
Correct!
Temporal
Incorrect.
Both spatial and temporal
Incorrect
Neither spatial nor temporal
Incorrect.
Checkpoint 11.3.3. Locality.
Consider the following snippet of C code:
int scores[100];
int i;
for (i = 0; i < 100; i++) {
scores[i] = 0;
}
Which type(s) of locality does this code exhibit?
Spatial
Don’t forget to consider the i variable.
Temporal
Incorrect.
Both spatial and temporal
Correct!
Neither spatial nor temporal
Incorrect.
Checkpoint 11.3.4. Locality.
Hint.
Think about the example of row-major ordering.
Checkpoint 11.3.5. Cache Conflicts.
How does a typical computer system determine what to keep in its CPU cache?
It keeps things that it has used in the past.
Correct!
Programmers provide hints about what will be needed in the future.
Incorrect.
Both A and B.
Incorrect
Neither A nor B
Incorrect.