Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

struct algae _ position { float x; float y; } ; struct algae _ position grid [ 1 6 ] [ 1 6 ] ;

struct algae
_
position
{
float x;
float y;
}
;
struct algae
_
position grid
[16][16]
;
float total
_
x
=
0
,
total
_
y
=
0
;
int i
,
j;
You should also assume the following:
sizeof
(
float
)
=
=
4
.
grid begins at memory address
0
.
The cache is initially empty.
The only memory accesses are to the entries of the grid array grid. the variables i
,
j
,
total x
,
total y are stored in registers.
We consider the following code:
for
(
i
=
0
; i
<
16
; i
+
+
){
for
(
j
=
0
; j
<
16
; j
+
+
){
total
_
x
+
=
grid
[
j
][
i
]
.
x;
total
_
y
+
=
grid
[
j
][
i
]
.
y;
}}Analyze the cache performance of this code (provide some short explanations so we see how you got the result; it helps to draw the cache):
(a) What is the total number of reads?
(b) What is the total number of reads that miss in the cache?
(c) What is the miss rate?
(d) What would the miss rate be if the cache were twice as big?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions