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
Language:C Write the function that produces the largest and smallest elements of an integer array sent to it, in accordance with the main function below. (Access to array elements should be done according to offset-address increment notation.)Sample Run:Biggest : 23Smallest : 0Sample Main................................/*prototip*/int main(){int array[5]={23, 4, 2, 0, 8};int biggest;int smallest;bigSmallFind(.............................)printf("Biggest : %d \n", biggest);printf("Smallest : %d \n", smallest);return 0; }
Language: Java Write the function that produces the largest and smallest elements of an integer array sent to it, in accordance with themain function below. (Access to array elements should be done according to offset-address increment notation.)Sample Run:Biggest : 23Smallest : 0Sample Main................................/*prototip*/int main(){int array[5]={23, 4, 2, 0, 8};int biggest;int smallest;bigSmallFind(.............................)printf("Biggest : %d \n", biggest);printf("Smallest : %d \n", smallest);return 0;}
An-Najah National University Department of Computer Engineering Microprocessors (10636322) Assignment # 1 Answer the following: 1- Write an 8086-assembly program that reads only vowels (a, e, i, o, u) from the keyboard (other characters are not excepted) and store them in a character array of 10 bytes long. Vowels entered after the array is full should be discarded. The program should stop reading characters when a 'S' is entered. When the 'S' character is entered, the program should output a new line, followed by the contents of the character array, with a space character between each vowel. 2- Write an assembly code to sort a word array of 50 numbers in ascending order. 3- The perfect number is defined as an integer which is equal to the sum of its divisors. Example: 28 is perfect number because 28 = 1+2+4 +7+ 14. Write an inline assembly e function that will takes an integer number as parameter and check whether it is a perfect number or not. Use the function in complete program. 4-…
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