Computer Systems: Program... -Access
Computer Systems: Program... -Access
3rd Edition
ISBN: 9780134071923
Author: Bryant
Publisher: PEARSON
Question
Book Icon
Chapter 6.5, Problem 6.18PP

A.

Program Plan Intro

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.

Program Plan Intro

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= 128+128=256

Hence,

miss rate=(numberofmiss/totalreads)×100%

Blurred answer
Students have asked these similar questions
4.1.1 Complete solution and answer only no need explanation Given three data points (1,6), (3,28), and (10, 231), What is the value of y at x = 2 if the function y = 2x2 + 3x + 1 passes through the three data points.
Problem 10
Problem 1.    Two DNA strands of length 100 (number of bases in the sequence) are given in DNA1.txt and DNA2.txt file.     Find the longest common subsequence (LCS) between the two sequences using dynamic programming bottom-up (tabulation) approach. Submit your code to solve the problem. How much time (in seconds or milliseconds) is required by your computer to run the algorithm? Solve the same LCS problem using dynamic programming top-down (memorization) approach. Submit your code to solve the problem. How much time (in seconds or milliseconds) is required by your computer to run the algorithm. Which solution is faster and why? Discuss your solutions.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr