Computer engineering Consider the following code for i 0 i 2
Computer engineering!!!!!
 Consider the following code: for (i- 0; i 20: i++) alil j a. Give one example of the spatial locality in the code. b. Give one example of the temporal locality in the code Solution
Spatial locality: Whenever an specific location in memory is accessed it is useful to copy the data in the nearby locations of the memory location to special memory storage for faster access. In this case the array \'a\' is copied when it is first time accessed in the loop.
Temporal locality: Whenever a memory location is accessed, it is probable that the same memory location is accessed again. So the contents of the memory location is stored in special memory storage for faster access. In this case, the value of i and j are accessed repeatedly. So they are an example of temporal locality.

