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
Computer Systems: A Programmer's Perspective (3rd Edition)
- Assembly Language x86(Macro Micro)arrow_forwardLanguage: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; }arrow_forwardLanguage: 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;}arrow_forward
- 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-…arrow_forward3. Memory (a) How many locations of memory (in terms of the number of bytes) can you address with 17-bit memory address? (b) How many bits are required to address a 64-Mega-location memory, i.e, what should the number of bits of the memory address be in order to access a 64MB memory? (c) Assume A is an integer array with 20 elements stored in memory and its starting memory address is in X3. What is the memory address for element A[5]? (d) Assume C is a character array with 20 elements stored in memory and its starting memory address is in X4. What is the memory address for element C[12]? (e) Write at least five different ways to assign 0 to register X3.arrow_forwardOperating systems 116)According to page replacement algorithm, when a page fault occurs, the operating system divides all the pages into four classes based on the current values of thee R and M bits: Class 0: Page A, Page B, Page C Class 1: Page D, Page E Class 2: Page F. Page G Class 3: Page H. Page I, Page J 79. According to this classification, if a page fault occurs, what is the possibility of Page C to be evicted from the memory? A) %25 B) %33.3 C) %0 D) %10arrow_forward
- c programming not c++arrow_forward[1] ( Show your work. Show hoe you compute memory address by using the effective memory address computation. Assume the following values are stored at the indicated memory addresses and registers: Address Value 0x100 OxFF 0x104 OxAB 0x108 0x13 0x10c 0x11 Register %rax %rcx %rdx $0x108 (%rax) 4(%rax) 9(%rax, %rdx) 260(%rcx,%rdx) OxFC (,%rcx, 4) (%rax, %rdx, 4) Value 0x100 0x1 0x3 Fill in the following table showing the values for the indicated operands: Operand Value %rax 0x104arrow_forward< 5:37: Assembly Language Pro... Pointer Example ● • This is Example 4.4 from the textbook which demonstrates the use of the Loadl and Storel instructions to print a string • It is important to remember that at the assembly level, all I/O is character-based and only one character at a time can be sent to an output device Getch, Outp, One, Chptr, String, LoadI Chptr Skipcond 400 Jump Outp Halt Output Load Chptr Add One Store Chptr Jump Getch Hex 0001 Hex 00B Dec 072 Dec 101 Dec 108 Dec 108 Dec 111 Dec 032 Dec 119. Dec 111 Dec 114 Dec 108 Dec 100 Dec 033 Dec 000 /H /e /1 /1 / [space] /W /0 /r /1 /d /[null] LTE 100 D /Load the character found at /address Chptr /If AC = 0, skip next instruction /Otherwise, proceed with operation /Output the character /Move pointer to next character /Jump to "current" character /Pointer to "current" character /String definition starts herearrow_forward
- 15. The only way to access data stored in heap memory is through pointer variables malloc () allocation tables а. b. С. d. a buffer memoryarrow_forwardsolve the ff. python program see the following picture for instructionarrow_forwardComputer Science Q1. Part a) A memory is byte addressable and has a 18-bit address. All the addresses are valid. What is the total size of the memory? Part b) A memory is byte addressable and has a total size of 20,480 bytes (20 KB). What is the smallest address size that can be used for this memory?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education