324_Book

# It is good programming practice to protect your

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: i].k = 0; } } A. What is the total number of writes? _______. B. What is the total number of writes that miss in the cache? _______ . C. What is the miss rate? _______. Homework Problem 6.27 [Category 1]: Given the assumptions in Problem 6.25, determine the cache performance of the following code: 1 2 3 4 5 6 7 8 9 10 11 12 for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { square[i][j].y = 1; } } for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { square[i][j].c = 0; square[i][j].m = 0; square[i][j].k = 0; } } A. What is the total number of writes? _______. B. What is the total number of writes that miss in the cache? _______ . C. What is the miss rate? _______. Homework Problem 6.28 [Category 2]: You are writing a new 3D game that you hope will earn you fame and fortune. You are currently working on a function to blank the screen buffer before drawing the next frame. The screen you are working with is a ¼ ¢ ¼ array of pixels. The machine you are working on has a 64 KB direct-mapped cache with 4-byte lines. The C structures you are using are: 6.7. SUMMARY 1 2 3 4 5 6 7 8 9 10 11 343 struct pixel { char r; char g; char b; char a; }; struct pixel buffer[480][640]; int i, j; char *cptr; int *iptr; Assume: ¯ ¯ ¯ ¯ sizeof(char) == 1 and sizeof(int) == 4 buffer begins at memory address 0. The cache is initially empty. The...
View Full Document

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online