this post was submitted on 04 Aug 2023
181 points (97.9% liked)
Explain Like I'm Five
14228 readers
2 users here now
Simplifying Complexity, One Answer at a Time!
Rules
- Be respectful and inclusive.
- No harassment, hate speech, or trolling.
- Engage in constructive discussions.
- Share relevant content.
- Follow guidelines and moderators' instructions.
- Use appropriate language and tone.
- Report violations.
- Foster a continuous learning environment.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Dynamic RAM is a bucket with a hole in it. Genuinely, that is the model that makes it so cheap.
Static RAM is the proper way to do memory: half a dozen transistors form each bistable flip-flop, so there's two input wires and one output wire, and the output wire is either high or low depending on which input wire was used most recently. Static RAM will maintain its state using comically low power. Static RAM runs on the idea of electricity. It's how cartridge games from the 90s had save files. There's a button-cell battery that was enough to power some kilobits of memory for an entire decade. But because static RAM uses so many gates, it takes up a lot of silicon, and it is hideously expensive, to this day.
Dynamic RAM is a stupid engineering workaround that happens to be really, really effective. Each bit is a capacitor. That's all. It will slowly drain, which is why your laptop has to hibernate to disk instead of lasting forever like Pokemon Red. When a capacitor has charge, applying more power is met with resistance, which lets the sole input wire detect the state of that bit. And so long as you check every couple milliseconds, and refill capacitors that are partially charged... the state of memory is maintained. On very old machines this might have been done by the machine. IIRC, on SNES, there's a detectable stall in the middle of each scanline, where some ASIC reads and then writes a portion of system memory. On modern devices that's all handled inside the memory die itself. The stall is still there, but if it affects your program, you are doing something silly.
The RAM in your machine has nigh-unlimited write cycles because it will naturally return to zero. It is impermanent on the scale of microseconds. By design, your data has no lasting impact. That is central to its mechanism.