一次内存读,硬件走了几步
一次普通的内存读,硬件到底走了几步?
Copy the prompt, then pick a model. It plays the interviewer and asks you through it scene by scene instead of handing you the answer.
On a phone with the app installed, the system opens the app directly. Links cannot open external apps inside WeChat — open it in a browser first.
The copied text ends with the answer key the model grades you against. Don't read it yourself first — working it out on your own is the point.
这一份的分水岭是一问:翻译缓存没命中,和一个页根本不在内存里,是同一件事吗? 两者差三到四个数量级,一个纯硬件几十周期,一个要陷进内核 —— 分不清这两个,线上看到 fault 数飙升时就不知道该往哪查。
前面几幕会逼你自己算出「一张页表要 4MB、每个进程一张」,然后自己推出为什么必须分级、为什么必须有那个缓存。
顺带回答一个很多人记反的问题:虚拟内存的主要目的到底是不是「内存不够时拿磁盘顶上」。
What this one drills
This prompt in the repo (the answer key is at the end of that file — you'll see it)
Have you done this one?
Sign in to mark this one as practised — next time you come back you'll see when you did it.
Notes from people who did this one
How to use this
This set teaches rather than interrogates: it guides you instead of pressing until you have nothing left to say. When you're stuck it first asks which layer you're stuck at (never heard of it / know it but not why / know why but can't apply it), then decides what to give. Only after guiding you twice on the same point will it spell it out — and then it asks you to say it back in your own words.
It will keep pushing you for numbers: answer "there's some overhead" or "it's faster" and it cuts you off. A conclusion you can't put a number on is a memorised one — that's exactly what this set drills.
How to start
- Pick one, open it, copy the prompt.
- Paste it into a brand-new conversation, say nothing, and wait for its first question.
- Expect to be asked for orders of magnitude: how many nanoseconds, how many microseconds, how many times slower. Saying you don't know is fine — it notes it and moves on.
Four commands you can call out at any time
跳过move to the next scene now换个说法explain this bit again from another angle直说吧spell the answer out, then make me say it back复盘jump to the wrap-up and print the review card
Three traps
- Don't read the answer key at the end first — that "how people get it wrong" section is the answer to every question it will ask.
- Don't reach for the jargon. Saying "that's a TLB miss" is easy; saying how much cheaper it is than a page fault is the part that counts.
- When it starts praising you, point it back to the "don't praise me" rule. Guiding is not coddling.
Want a feel for the numbers? Start with random reads and the first-byte one. For production debugging: malloc, TCP stalls, context switches. Writing concurrent code: reordering and false sharing.
Sign in to write a note.