37 b kernighan and d ritchie the c programming

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 16-byte cache line holds two contiguous algae position structures. Each loop visits these structures in memory order, reading one integer element each time. So the pattern for each loop is: miss, hit, miss, hit, and so on. Notice that for this problem, we could have predicted the miss rate without actually enumerating the total number of reads and misses. A. What is the total number of read accesses? 512 reads. B. What is the total number of read accesses that miss in the cache? 256 misses. C. What is the miss rate? ¾ ½¾ ¼± . Problem 6.16 Solution: [Pg. 326] The key to this problem is noticing that the cache can only hold ½ ¾ of the array. So the column-wise scan of the second half of the array evicts the lines that were loaded during the scan of the first half. For example, reading the first element of grid[16][0] evicts the line that was loaded when we read elements from grid[0][0]. This line also contained grid[0][1]). So when we begin scanning the next column, the reference to 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