Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following segment of C code #define SIZE 1000 int a[SIZE], b[SIZE]; int i, j; for (i = 0; i < SIZE; i++)
Consider the following segment of C code #define SIZE 1000 int a[SIZE], b[SIZE]; int i, j; for (i = 0; i < SIZE; i++) { j = SIZE - Ei; a[i] = b[j]; } for (i = 0; i < SIZE; i++) { (i + SIZE/2) % SIZE; a[i]= a[i] b[j]; j } Assume that an ints are 32 bits long. (a) References to which variable(s) exhibit temporal locality in this code? Remember that each element of an array is a variable. (b) References to which variable(s) exhibit spatial locality in this code? (c) The cache of the system executing this code consists of 256 blocks, and each block can hold 16 bytes. How many bytes can fit into this cache at one time? (d) Ignoring instructions, and assuming that a and b are stored adjacent to each other in memory, how large would the cache have to be to hold the entire contents of both arrays at the same time? Give your answer in bytes, KiB, or MiB, as appropriate.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started