subject

The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of 256 algae. You are evaluating its cache performance on a machine with a 1024-byte direct-mapped data cache with 16-byte blocks (B = 16).

You are given the following definitions:

//Code

struct algae_position {
int x;
int y;
};

struct algae_position grid[16][16];
int total_x = 0, total_y = 0;
int i, j;

//End of Code
Assuming the cache starts empty, when the following code is executed:

//Code

for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
total_x += grid[i][j].x;
}
}
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
total_y += grid[i][j].y;
}
}

//End of Code

There are (Blank_1) total reads or loads and (Blank_2) reads or loads that miss in the cache,
resulting in a cache miss rate of (Blank_3) %.

Assuming the cache is emptied again, when the following code is executed:

//Code

for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
total_x += grid[i][j].x;
total_y += grid[i][j].y;
}
}

//End of code
There are (Blank_4) total reads or loads and (Blank_5) reads or loads that miss in the cache,
resulting in a cache miss rate of (Blank_6) %.

If the cache was twice as big, the miss rate would be (Blank_7) %.

A: I got Blank_1 = 512, Blank_2 = 256 and Blank_3 = 50%.
I can't seem to figure out the answers for the second loop

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What is the original authority for copyright laws
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
You know the right answer?
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of...
Questions
question
Mathematics, 27.04.2020 03:14
question
Social Studies, 27.04.2020 03:14
question
Mathematics, 27.04.2020 03:14
Questions on the website: 13722367