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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 03:00, tay9122
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
image
Computers and Technology, 23.06.2019 08:30, Bradgarner772
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
image
Computers and Technology, 23.06.2019 14:00, ava5015
What is html ? give a small description about html
Answers: 2
image
Computers and Technology, 24.06.2019 00:40, iamsecond235p318rq
To maintain clarity and focus lighting might be needed
Answers: 2
You know the right answer?
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of...

Questions in other subjects:

Konu
Social Studies, 09.06.2021 02:20
Konu
Mathematics, 09.06.2021 02:20
Konu
Mathematics, 09.06.2021 02:20
Konu
Chemistry, 09.06.2021 02:20