DRAM stores each bit as charge on a tiny capacitor, and capacitors leak. Leave a row alone long enough and a 1 becomes indistinguishable from a 0. Refresh is the rent you pay to keep your data, and in interviews it's a great topic because it connects device physics, controller design, and performance.

The refresh contract

Every row must be refreshed within a retention window. For DDR5 that window (tREFW) is 32 ms at normal temperatures. Rather than refreshing everything at once, the controller sends a refresh command on average every tREFI, and the device refreshes a slice of rows internally each time, using its own row counter.

tREFI = 32 ms / 8192 refresh commands ≈ 3.9 µs

Above 85 °C, leakage speeds up and tREFI halves to about 1.95 µs. That's a good detail to have ready if someone asks how temperature affects DRAM.

What one refresh costs

An all-bank refresh (REFab) makes the whole rank unavailable for tRFC. tRFC grows with density, because there are more rows to cover per command: typical tRFC1 values are around 195 ns for an 8 Gb die and 295 ns for 16 Gb.

The refresh tax: tRFC / tREFI = 295 ns / 3906 ns ≈ 7.6% for a 16 Gb die. Roughly one twelfth of the rank's time goes to refresh. Above 85 °C it roughly doubles. At high density, refresh is a first-order performance and power problem, not a footnote.

What DDR5 changed

  • Same-bank refresh (REFsb): refreshes the same bank index in every bank group while the other banks keep serving traffic. Each one is shorter, so refresh can hide behind work in other banks.
  • Refresh Management (RFM): the controller counts activates per bank and sends extra management commands to heavily activated banks, giving the device time to mitigate read-disturb effects like RowHammer.

The classic controller bug: refresh starvation

A natural first design refreshes only when the rank is idle. Under light traffic that works. Under sustained traffic the rank is never idle, so refresh never happens, and in real silicon that means data loss.

The fix is escalating urgency. Keep a counter of owed refreshes that goes up every tREFI. At low debt, refresh opportunistically in idle gaps. Past a threshold, stop issuing new activates, precharge the open banks, and force the refresh, well before the postponement limit in the spec.

The lesson interviewers love: liveness properties need adversarial traffic. "Refresh eventually happens" only gets tested if your testbench never gives the controller a break.

Interview checks

  • How does refresh interact with traffic? It steals rank (or bank) time. Hide it in idle gaps, but guarantee it with an urgency mechanism.
  • How would you reduce its cost? Same-bank refresh, scheduling into idle periods using the postpone and pull-in allowance, and a scheduler that doesn't open rows that are about to be forced closed.

One-page summary

tREFI, tRFC, and every other DDR5-4800 timing parameter with its physical cause are on a free printable cheat sheet: download it here.

Typical published values; confirm against your device datasheet and JEDEC JESD79-5.