Computers and Technology, 14.03.2020 00:27 lolo8787
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
Answers: 1
Computers and Technology, 21.06.2019 18:30
Ineed on my history if anyone can check out the last few questions i posted and i will be posting !
Answers: 2
Computers and Technology, 23.06.2019 05:20
What did creator markus “notch" persson initially call his game
Answers: 1
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of...
Mathematics, 11.03.2021 20:20
History, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
Chemistry, 11.03.2021 20:20
English, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20
History, 11.03.2021 20:20
Mathematics, 11.03.2021 20:20