C8 · Problem set 11
Problem set 11: virtual memory, DRAM and buses
These problems use lessons 47 to 51: virtual memory and TLBs, DRAM timing and bandwidth, buses and wait states, and the cache and memory lab. Addresses are 32 bits unless a problem says otherwise.
Check
A memory interface makes 3200 million transfers a second over 64 bits.
(a)
What is its peak bandwidth?
(b)
How long does a 128-byte line take to stream out?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
DRAM timings are CL = tRCD = tRP = 13.75 ns. 30% of accesses hit an open row, 20% go to an idle bank, and the rest are row conflicts.
(a)
What is the average time to first data?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
What does a conflict cost?
Check
Flash takes 35 ns per read on a 64 MHz core.
(a)
How many wait states does it need?
(b)
Without a prefetch buffer, how many cycles does each instruction fetch take?
Check
A channel gives 25.6 GB/s with 60 ns of latency, moving 128-byte lines.
(a)
How many misses must be in flight to use it fully?
(b)
What bandwidth does one miss at a time get?
Check
A loop has 64 independent cache misses of 100 ns each; the core can have 4 outstanding at once.
(a)
About how long do they take?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
And one at a time, as in pointer chasing?
Check
A TLB has 64 entries and pages are 4 KiB.
(a)
What is its reach, the memory it can map at once?
(b)
And with 2 MiB huge pages?
Check
Memory takes 100 ns; a page fault takes 5 ms to service. 10 accesses in a million fault.
(a)
What is the effective access time?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
At most how many faults per million accesses keep the slowdown under 10%?
Check
A process on a 32-bit machine with 4 KiB pages and a two-level table (10, 10, 12 bits, 4-byte entries) has 12 MiB of code and data from address 0, and 1 page(s) of stack at the top.
(a)
How many page-table pages does it need?
(b)
How much memory is that?
Check
A virtual address has 36 bits, and pages are bytes with p = 12.
(a)
How many virtual pages are there?
(b)
How big would a flat table of 8-byte entries be?
Check
Virtual address 00103000 is in a page mapped to physical page number 498, with 4 KiB pages.
(a)
What is the page offset?
(b)
What is the physical address?
Check
A direct-mapped 4 KiB cache with 64-byte lines holds an R × R int matrix, R = 128, summed by columns.
(a)
How many different sets does one column use?
(b)
How many rows share each of those sets?
Check
A program streams through memory in 32-byte accesses; DRAM rows are 2048 bytes, and nothing else uses the bank.
(a)
What fraction of accesses hit the open row?
(b)
How many accesses are made per row?
Check
A DMA stream moves 50 MB/s over a bus that carries 200 MB/s.
(a)
What share of the bus does it use?
(b)
How much is left for the processor?
Check
A flash interface fetches 128 bits (four instructions) per read, with 2 wait state(s). Taken branches, one every 5 instructions, flush the prefetch buffer.
(a)
How many cycles does one flash read take?
(b)
What is the CPI, if each taken branch stalls for the wait states and straight-line code runs at one a cycle?
Check
Two streams in the same DRAM bank alternate accesses, each 32 accesses long; their rows differ. Timings are CL = tRCD = tRP = 14 ns.
(a)
How many accesses hit an open row?
(b)
How long do the accesses wait for data in all?
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.