Question: a) Examine the code given below to compute the average of an array: total 0 for (j=0; j ? k; j++) sub total - 0

a) Examine the code given below to compute the average of an array: total 0 for (j=0; j ? k; j++) sub total - 0 /* Nested loops to avoid overflow * sub total + A[j*N j ; total +- sub total/N; averagetotal/k; When designing a cache to run this application, given a constant cache capacity and associativity, will you want a larger or smaller block size? Why? b) examine the MODIFIED code given below: total 0; sub total - O; * Nested loops to avoid overflow * or (j=0; Sub total +-A[ *N + i] ; total +sub total/k; average total/N; = Generally, how will the size of the array and the cache capacity impact the choice of block size for good performance? Why
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
