A.
Given Information:
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of 256 algae. One needs to determine the cache performance on a machine that has a 1024 byte direct mapped data cache with 16 byte blocks (B=16).
The definition for the game is mentioned below:
//Declare structure algae_position
struct algae_position{
int x;
int y;
};
//declare grid
struct algae_position grid[16][16];
//variable declaration
int total_x=0, total_y=0;
int i,j;
//traverse through grid to add x
for(i=0;i<16;i++)
{
for(j=0;j<16;j++)
{
total_x+= grid[i][j].x;
}
}
//traverse through grid to add y
for(i=0;i<16;i++)
{
for(j=0;j<16;j++)
{
total_y+= grid[i][j].y;
}
}
B.
Given Information:
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of 256 algae. One needs to determine the cache performance on a machine that has a 1024 byte direct mapped data cache with 16 byte blocks (B=16).
The definition for the game is mentioned below:
//Declare structure algae_position
struct algae_position{
int x;
int y;
};
//declare grid
struct algae_position grid[16][16];
//variable declaration
int total_x=0, total_y=0;
int i,j;
//traverse through grid to add x
for(i=0;i<16;i++)
{
for(j=0;j<16;j++)
{
total_x+= grid[i][j].x;
}
}
//traverse through grid to add y
for(i=0;i<16;i++)
{
for(j=0;j<16;j++)
{
total_y+= grid[i][j].y;
}
}
C.
Explanation of Solution
Miss rate:
It is observed that for all 256 reads, 128 of them are misses. Similarly, for the second loops another 128 reads will be missed.
Hence, total number of misses=
Hence,
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
EBK COMPUTER SYSTEMS
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY