Question: Consider the function compute variance listed below, which computes the variance of integer numbers stored in the array data. 1 int data [ N ]
Consider the function compute variance listed below, which computes the variance of
integer numbers stored in the array data.
int dataN;
int computevariance
int sum sum result;
int i;
fori; i N; i
sum datai;
sum N;
fori; i N; i
sum datai datai;
sum N;
result sum sumsum;
return result;
Suppose this program is executing on a bit processor with a directmapped cache
with parameters m k n S e e t h e F i g u r e f o r t h e
e x p l a n a t i o n o f m k a n d n
F i g u r e
We make the following additional assumptions:
An int is bytes wide.
sum sum result, and i are all stored in registers.
data is stored in memory starting at address x
Answer the following questions:
a How many blocks will be in the cache? points
b How many bytesperblock will be in the cache? points
c Consider the case where N is How many cache misses will there be
This question is solved for you.
d Now suppose that N is Based upon the above solution, recompute the number
of cache misses. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
