C850 of 55
0 XP
  1. Hook
  2. Problems

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, 212-byte pages and 8-byte page-table entries.

(a)

How many bits is the virtual page number?

(b)

A single-level table would be 2x 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?

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.