Suppose we have two 2-dimensional arrays a and b, and consider the following C code. int a[4][4]; int b[4][4]; for (int i = 0; i < 4; i++) for (int j = e; j < 4; j++) { a[i][j] = 0; b[j][i] = 1; Assume that array a starts at address 0 and array b starts at address 64; the size of int is 4 bytes; the cache is 32 bytes and direct-mapped with a block size of 16 bytes; the cache is initially empty; accesses to the a and b arrays are the only sources of misses. (a) Out of 16 accesses to array a, how many are cache misses? (b) Out of 16 accesses to array b, how many are cache misses?

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.3: Declaring And Processing Two-dimensional Arrays
Problem 4E: (Practice) Write a C++ program that adds equivalent elements of the two-dimensional arrays named...
icon
Related questions
Question
Suppose we have two 2-dimensional arrays a and b, and consider the following C code.
int a[4][4];
int b[4][4];
for (int i = 0; i < 4; i++)
for (int j = e; j < 4; j++)
{
a[i][j] = 0;
b[j][i] = 1;
Assume that array a starts at address O and array b starts at address 64; the size of int is 4 bytes; the cache is 32 bytes and direct-mapped with a block size of 16
bytes; the cache is initially empty; accesses to the a and b arrays are the only sources of misses.
(a) Out of 16 accesses to array a, how many are cache misses?
(b) Out of 16 accesses to array b, how many are cache misses?
Transcribed Image Text:Suppose we have two 2-dimensional arrays a and b, and consider the following C code. int a[4][4]; int b[4][4]; for (int i = 0; i < 4; i++) for (int j = e; j < 4; j++) { a[i][j] = 0; b[j][i] = 1; Assume that array a starts at address O and array b starts at address 64; the size of int is 4 bytes; the cache is 32 bytes and direct-mapped with a block size of 16 bytes; the cache is initially empty; accesses to the a and b arrays are the only sources of misses. (a) Out of 16 accesses to array a, how many are cache misses? (b) Out of 16 accesses to array b, how many are cache misses?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage