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:

1 2 3 4 5 6 7 8 struct algae_position { int x; int y; }; struct algae_position grid [32] [32]; int total_x =

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:

1 2 WN 3 4 5 6 789 10 11 for (i = 31; i >= 0; i--) { } for (j = 31; j >= 0; j--) { total_x += grid [i][j].x;

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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Computer Systems A Programmers Perspective

ISBN: 9781292101767

3rd Global Edition

Authors: Randal E. Bryant, David R. O'Hallaron

Question Posted: