The heart of the recent hit game SimAquarium is a tight loop that calculates the average position
Question:
The heart of the recent hit game SimAquarium is a tight loop that calculates the average position of 512 algae. You are evaluating its cache performance on a machine with a 2,048-byte direct-mapped data cache with 32-byte blocks (B = 32). You are given the following definitions:
You should also assume the following:
. sizeof(int) = 4.
. grid begins at memory address 0.
. The cache is initially empty.
. The only memory accesses are to the entries of the array grid. Variables i, j, total_x, and total_y are stored in registers.
Determine the cache performance for the following code:
A. What is the total number of reads?
B. What is the total number of reads that miss in the cache?
C. What is the miss rate?
Step by Step Answer:
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron