Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
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
Computer science Computer organization subject
Systems Programming Purpose: The purpose of this assignment is to practice loop instructions and array iterations in M6800 assembly language programming. Write an assembly language program which implements the following C code that is a find minimum problem solution implementation: int A[10] = {8, 14, 6, 16, 5, 5, 10, 9, 4, 11}; int i = 0; int min = 255; // This is the largest number 8-bit accumulators can hold. while (i < 10) { if (A[i] < min) min = A[i]; } Your solution should be able to handle all possible array elements and orderings for any value an accumulator can hold. You should treat variable į as XR in assembler (index register) and store variable min in the address 60H. 0010: 00 00 00 00 00 00 00 00 0O 00 00 00 00 00 00 00 8628: 00 060 00 00 00 600 00 00 00 08 08 00 6 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 G0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 006 0: 00 00 00 00 00 00 00 00 00 08 00…
COAL - Computer Organization and Assembly Language
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education