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 Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
- Operating 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[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_forward15. The only way to access data stored in heap memory is through pointer variables malloc () allocation tables а. b. С. d. a buffer memoryarrow_forward
- 3. 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_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_forwardQ1- Write a program in assembly language for the 8085 microprocessor to send one byte of data located at the memory address (3000H) using SOD at a baud rate of 1200. Information: The 8085 processor operates at a frequency of 3.072 MHz. When sending the required byte, you must adhere to the following: The two high bits of the start bits must be sent, after that the data bits are sent, after that the low bit of the stop bit is sent. The following flowchart will help you. The solution must be integrated and include the calculation of the baud rate delay time Transmit Set up Character Bit Counter • Send Start Bit No Wait Bit Time Get Character in Accumulator Output Bit Using Do Wait Bit Time Rotate Next Bit in Do Decrement Bit Counter Is It Last Bit? Yes • Add Parity if Necessary Send Two Stop Bits Return (a)arrow_forward
- For the following loop assume the array arr2[][] has never been referenced before in the code. Also assume that a cache line is 32 Bytes, and an int is 4 Bytes. 1. How many memory references are there?arrow_forwardb. An array, called myArray, consists of 120 elements stored in MIPS data memory at base address 0x10001000. a. (10%) What is the address of the element myArray[77]? b. (10%) Register $t0 contains the value Ox10104567. If you are asked to store this value into myArray[77], how will the value be stored in MIPS data segment? Show the addresses.arrow_forward(a) Find the value of AX and EAX registers.dataarrayW WORD 7000h,8000h,9000harrayD DWORD 1,2,3,4.codemov ax,[arrayW+2] ; AX =mov ax,[arrayW+4] ; AX =mov eax,[arrayD+4] ; EAX =(b) write a program that adds the following three bytes:.datamyBytes BYTE 80h,66h,0A5harrow_forward
- Computer 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_forwardsubject: microprocessor and assembly language Data transmission systems and file subsystems often use a form of error detection that relies on calculating the parity (even or odd) of blocks of data. Your task is to create a procedure that returns True in the EAX register if the bytes in an array contain even parity, or False if the parity is odd. In other words, if you count all the bits in the entire array, their count will be even or odd. Preserve all other register values between calls to the procedure. Write a test program that calls your procedure twice, each time passing it a pointer to an array and the length of the array. The procedure’s return value in EAX should be 1 (True) or 0 (False). For test data, create two arrays containing at least 10 bytes, one having even parity, and another having odd parity.arrow_forwardMIPS Assembly The program: Write a function in MIPS assembly that takes an array of integers and finds local minimum points. i.e., points that if the input entry is smaller than both adjacent entries. The output is an array of the same size of the input array. The output point is 1 if the corresponding input entry is a relative minimum, otherwise 0. (You should ignore the output array's boundary items, set to 0.) My code: # (Note: The first/last entry of the output array is always 0# since it's ignored, never be a local minimum.)# $a0: The base address of the input array# $a1: The base address of the output array with local minimum points# $a2: Size of arrayfind_local_minima:############################ Part 2: your code begins here ###la $t1, ($t2)la $t1, ($t2)move $a1, $s0 li $a2, 4jal find_local_minima print:ble $a2, 0, exitlw $a0, ($s0)li $v0, 1syscall addi $s0, $s0, 4addi $a2, $a2, -1 ############################ Part 2: your code ends here ###jr $ra I am not getting the correct…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