C 5 points Assume that the cache is a write through write allocating cache that

# C 5 points assume that the cache is a write through

• Test Prep
• 17
• 100% (3) 3 out of 3 people found this document helpful

This preview shows page 15 - 17 out of 17 pages.

C.(5 points) Assume that the cache is a write-through, write-allocating cache that uses prefetching. Below are several memory accesses that might be performed. Each reads or writes a single byte. For each memory access, find the tag, set index, and block offset, indicate whether it is a hit, and give the number of memory reads and writes caused by the access. If the read is a cache hit, give the value it returns. (For each operation, assume the cache is in the state depicted above.)D.(5 points) If you wanted to improve the performance of a program on a system that uses a cache, what could you do even if you don’t know any details about the cache?AccessTagSetOffsetHitReadsWritesValueR 0303R 1FEBR 14FDW 1000W 06ABof 1517 6. Extra Credit A.(3 points) Spell three English words using the hex digits A–F and write their values in octal. (For example, BAD16= 56758.)B.(3 points) Why is it recommended for you to use AddressSanitizer?C.(3 points) Describe a programming error you made on one of the projects, how you diagnosed it, and how you corrected it. of 16 17 D.(6 points) A pennantis a data structure consisting of nrows, numbered 0 to nwhere row icontains 2i+1 elements, numbered ito i. An n-row pennant contains n2elements (since the sum of the first nodd numbers is n2). A pennant may be represented as a 1-dimensional array containing each row in order. (That is, containing (0,0), (1,1), (1,0), (1,1), (2,2), ….) Write a function that returns a pointer to element R,Cof an n-row pennant. You may assume that |C| R< int *lookup(int *P, int R, int C) {of 17 1, n . 17 • • • 