C8 · Problem set 10
Problem set 10: caches, virtual memory and simulation
These problems use lessons 44 to 49: set-associative caches, replacement and write policies, levels of cache, virtual memory with page tables and TLBs, and the cache, predictor and pipeline simulators of the lab. Addresses are 32 bits unless a problem says otherwise, and 1 KiB is 1024 bytes.
Check
A 64 KiB, 8-way cache has 32-byte lines.
(a)
How many index bits?
(b)
How many tag bits?
Check
A cache has 512 sets of 32-byte lines. A load reads address 123456.
(a)
Which set does it use?
(b)
What tag value is stored for it?
Check
L1: 1 cycles, 0.02 miss rate. L2: 14 cycles, local miss rate 0.5. Memory: 100 cycles.
(a)
What is the AMAT?
(b)
What percentage of all accesses go to memory?
Check
A processor has a base CPI of 1, makes 0.25 data accesses per instruction (plus one instruction fetch, which always hits), and its data cache misses 0.05 of the time with a 150-cycle penalty.
(a)
What is the CPI including data misses?
(b)
What percentage of the cycles are spent waiting for misses?
Check
A loop reads all 2000 elements of a 2-byte array in order, 10 times. The array is line-aligned and the cache, much larger than the array, starts empty with 64-byte lines.
(a)
How many misses?
(b)
What is the miss rate over all the reads?
Check
A loop stores to 4 different words of the same 64-byte line, 20 times each, then the line is evicted.
(a)
How many writes reach memory with a write-through cache?
(b)
How many line write-backs with a write-back cache?
Check
A program touches virtual address 0471C588, with 4 KiB pages.
(a)
What is the virtual page number?
(b)
What is the offset?
Check
A virtual page is mapped to physical page 001F2; the access is at offset 010 in a 4096-byte page.
(a)
What is the physical address?
(b)
What are its low 12 bits?
Check
A machine has 39-bit virtual addresses, -byte pages and 8-byte page-table entries.
(a)
How many bits is the virtual page number?
(b)
A single-level table would be bytes. What is x?
Check
A 1-cycle TLB hits 0.97 of the time; memory takes 80 cycles; the page table has 4 levels.
(a)
What is the average access time?
(b)
What percentage of that time is page-table walking?
Check
A TLB has 128 entries and pages are 4 KiB.
(a)
What is its reach?
(b)
How many 4 KiB pages' worth of memory is that?
Check
The lab's fully associative LRU cache has 8 KiB in 64-byte lines. A loop reads every word of a 17 KiB array, 5 times.
(a)
How many misses?
(b)
How many lines does the array span?
Check
A TLB hits 99.5% of the time in 1 cycle; a miss walks a 3-level page table in memory (80 cycles per access) before the data access.
(a)
How many memory accesses does a TLB miss add?
(b)
What is the average access time, with the data in memory?
Check
A loop sweeps 24 KiB repeatedly through a fully associative LRU cache of 16 KiB with 64-byte lines.
(a)
After the first pass, how many misses does each pass take?
(b)
How many does the first pass take?
Check
A DDR channel makes 1600 million transfers a second over 64 bits; CL = tRCD = tRP = 13.75 ns, and 80% of accesses hit an open row (the rest conflict).
(a)
What is its peak bandwidth?
(b)
What is the average time for a 64-byte line, latency plus burst?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Have paper and a calculator ready. Work each problem out by hand, then enter the answer. Your first try on each one counts toward your score.
Practice
Keep practicing
15 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.