C846 of 55
0 XP
  1. Hook
  2. Problems

C8 · Problem set 9

Problem set 9: caches, writes and coherence

These problems use lessons 39 to 45 with the weight on caches: organization and address splitting, average access time across levels, write policies, write buffers, DMA and coherence between cores. Addresses are 32 bits and words 4 bytes.

Check

A 32 KiB, 2-way set-associative cache has 64-byte lines.

(a)

How many index bits?

(b)

How many tag bits?

Check

L1 hits in 1 cycle and misses 4%; L2 takes 10 cycles and misses 40% of what reaches it; memory takes 200 cycles.

(a)

What is the AMAT?

(b)

What would it be without the L2?

Check

A loop stores to every word of a freshly allocated 32-byte line 6 times before it's evicted.

(a)

How many bytes does write-through send to memory?

(b)

How many does write-back with allocation move?

Check

A program is 20% stores through a write-through cache; the write buffer drains one store every 6 cycles.

(a)

How many stores per cycle can memory take?

(b)

What is the lowest CPI the stores allow, once the buffer is full?

Check

A write-back cache misses 5% of the time; a miss takes 80 cycles, plus 80 more if the evicted line is dirty, which 25% are. Hits take 1 cycle.

(a)

What is the average miss penalty?

(b)

What is the AMAT?

Check

A DMA receive buffer of 1500 bytes, with 32-byte cache lines.

(a)

How many lines must be invalidated if it starts on a line boundary?

(b)

And if it starts 24 bytes into a line?

Check

A direct-mapped 32 KiB write-back cache with 32-byte lines; each line keeps a tag, a valid bit and a dirty bit, for 32-bit addresses.

(a)

How many tag bits per line?

(b)

How many bits of tags, valid and dirty bits are there in all?

Check

A cache hits in 1 cycle(s) with a 50-cycle miss penalty.

(a)

What miss rate gives an AMAT of 4 cycles?

(b)

What hit rate is that?

Check

A processor with a base CPI of 1 makes 1.2 memory accesses per instruction; 1% miss, costing 100 cycles each.

(a)

What is its CPI?

(b)

What share of its time goes to memory stalls?

Check

Two cores each increment their own counter 1000 times, taking turns. The counters share one 64-byte line.

(a)

How many writes miss, with a write-invalidate protocol?

(b)

How many miss if each counter is padded into its own line?

Check

A memory has 40 ns of latency and then delivers 8 bytes per ns.

(a)

What is the miss penalty for 64-byte lines?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

(b)

And for lines twice as long?

Check

A loop stores 1000 words, once each, into a fresh array, with 32-byte lines.

(a)

How many bytes cross the bus with write-through, no-allocate?

(b)

And with write-back, write-allocate?

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.