Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Caches are usually divided into levels and store copies of information to these

ID: 3726359 • Letter: C

Question

Caches are usually divided into levels and store copies of information to these levels. Assuming that our cache has three levels and LI is the smallest and L3 is the largest level, and also assuming that our cache do not duplicate information which is available in another level, how will our cache store the variables in the code given? Please draw the levels and place the variables into these level and use the all three levels to store all the related information/variable. (10 points) 2. for (int i e; i

Explanation / Answer

Here, the variables are stored as below.

L1 Cache -- since it is given as the smallest; it will be close to the CPU and hence stores those instructions which are required for faster execution. So the variables like - "sum, count, i, myarray.length" will be in L1.

L2 cache -- next to L1 and has information which are not in L1. The variable "myarray" will be stored here.

I do not see any use of L3 cache here.