Rowhammer comes up in memory interviews more and more, partly because it's a great test of whether you understand what an activate physically does. Here's the mechanism, why DDR5 changed the rules, and what the memory controller now has to do about it.
What Rowhammer is
Every time a row is activated, its wordline swings high and then low again. Rows sit only nanometers apart, so each activation disturbs the cells in the neighboring rows a tiny bit, and they leak charge a little faster. One activation does nothing measurable. But activate the same "aggressor" row tens of thousands of times before the neighboring "victim" rows get refreshed, and some victim cells lose enough charge to flip.
Two details interviewers like:
- It's a disturbance between neighbors, not a read error. The victim row was never accessed. That's why it's a security problem: an attacker can flip bits in memory they're not allowed to touch.
- It's getting worse as DRAM shrinks. Smaller cells and tighter spacing mean fewer activations are needed to cause a flip. The threshold has dropped by more than an order of magnitude since the problem was first published in 2014.
Why normal refresh doesn't save you
Refresh rewrites every row once per refresh window (32 ms in DDR5). An attacker can fit a huge number of activations into that window, limited only by tRC (about 48 ns at DDR5-4800). That's far more than modern thresholds. Refreshing everything faster would fix it but costs too much bandwidth and power, because refresh already takes several percent.
The real fix is targeted refresh: find the rows being hammered and refresh just their neighbors.
The DDR4-era answer: TRR
DDR4 chips added Target Row Refresh, where the DRAM quietly tracks a few frequently activated rows and refreshes their neighbors during normal refresh commands. The problem was that the tracker was small and the details were undocumented. Researchers showed that hammering many rows at once could overwhelm it.
DDR5: RFM and PRAC
DDR5 gives the controller and the DRAM explicit tools.
- RFM (Refresh Management). A command the controller sends to give the DRAM a time window for preventive refreshes. In the original scheme, the controller counts activations per bank and issues RFM once a threshold is crossed.
- PRAC (Per Row Activation Counting). Added in the April 2024 DDR5 spec update as an optional feature. Every row gets its own activation counter inside the DRAM. When a row's count gets too high, the DRAM raises the ALERT signal (the Alert Back-Off protocol), and the controller must respond with a small number of all-bank RFM commands, each lasting a few hundred nanoseconds, so the DRAM can refresh the victims.
PRAC is precise because it counts every row, so it can't be fooled the way a small tracker can. The cost is extra counter bits in the array and some added row-cycle overhead, and those RFM windows stall the whole rank.
What the controller has to do
This is the part that makes it a controller question:
- Handle ALERT correctly. Finish the allowed in-flight activations, then issue the required RFMs within the time limit, and block traffic to the rank meanwhile.
- Schedule around it. RFMs are like surprise refreshes. A good scheduler treats them like refresh, draining or reordering work so the stall hurts less.
- Watch for fairness and side channels. One hammering thread can trigger RFMs that stall everyone sharing the channel. Researchers have shown that this timing can even leak information between processes.
How to answer in an interview
Explain the physics (activations disturb neighboring rows), why refresh alone can't keep up, and that the fix is targeted refresh. Then walk from TRR to RFM and PRAC, and finish with what the controller must do when ALERT fires.
Free cheat sheet
DDR5 refresh and timing parameters on one page: download it free. For 30 interview questions with model answers, see the DRAM & DDR5 Interview Field Guide.
This article was generated with AI from the author's study notes.
Top comments (0)