In a similar vein, why can we not use the technology of RAM to prolong the life-cycle of an SSD?

69 points

Writing to an SSD damages the SSD, however things saved to an SSD are persistent, meaning the data isn’t lost when the SSD doesn’t get any power. Writing to RAM doesn’t damage it and it is also quicker. However, data saved on RAM is not persistent, meaning that all data is lost as soon as the RAM is not connected to a power source. Also, RAM is a lot more expensive than SSD storage.

RAMs are already used to avoid writing to (or reading from) the SSD or HDD when possible, the concept is called “Caching”

permalink
report
reply
35 points

Even if it’s powered, RAM will lose its data on the order of a tenth of a second. RAM doesn’t just require power, it requires that your computer constantly read and rewrite it - so every 64ms your computer has to read every gigabyte of RAM and write it back.

permalink
report
parent
reply
16 points

Doesn’t the ram do that itself? Otherwise reading/writing all that data would waste tons of time for the CPU.

permalink
report
parent
reply
37 points

Yes - it’s been the job of the DRAM controller for almost the entire history of computing. But that’s still a part of the computer and if it stops working then your RAM will go blank in a fraction of a second

permalink
report
parent
reply
7 points

It’s been a very long time since my computer engineering course, and we didn’t cover this topic specifically, but I highly doubt it’s a full dump and reload. What likely happens is each ram address has a ttl flag or some way for the CPU to know when to rewrite the data, and it does it as needed.

Plus, the bus between the CPU and ram is ridiculously fast. Your pc could dump and reload all of its ram in the time it takes you to blink. And, with multiple cores, the task can be allocated to a single core, or divided up among all of them.

permalink
report
parent
reply
7 points

What!

permalink
report
parent
reply
4 points

Dynamic RAM tracks bits by using a capacitor for each bit. Caps’ charge bleeds out so you have to top it off again every so often. The way you do that is to just write the same data back again. So it reads and writes the same data to itself every refresh. The opposition to this is static RAM which does not use a capacitor and is just a clever arrangement of transistors. No refresh needed. It’s not typically used commercially except under special requirements, though as transisters are significantly more expensive. So the refresh strategy is the better choice for consumer hardware. DRAM has been dominant for decades.

permalink
report
parent
reply
10 points
*

If you ever have the chance to use an old Apple II computer, run a text mode program, wait til the owner is looking in the other direction and turn the power off and back on quickly.

For about a second, before you hear the loud BOOP and the screen clears, you’ll see whatever was on the screen just before you powered it off. But a few characters will be corrupted. Try it again, and wait a half a second longer than before. More characters will be corrupted.

For that brief second you’re looking at the contents of the video RAM, then the ROM (Apple called what we call BIOS now “ROM”) clears the contents and puts up the familiar text banner. The longer the power stays off, the more the contents of those RAM cells decay, and any bit flip will show up as a different character at the corresponding location on the screen.

On a side note, there was an article in the early '80s in Circuit Cellar by Steve Ciarcia showing how you could make a rudimentary digital camera by prying the top off a DRAM chip (some were ceramic with metal lids, or just metal cans) and adding a CCTV camera lens at the right distance. Light can deplete the charge in DRAM cells even faster, and by writing all 1s to the memory, exposing it to light, and reading back the contents, you could get a black and white image of whatever’s shining on the chip.

permalink
report
parent
reply
1 point

Note that when you freeze the RAM a lot, it will hold the data for up to seconds (if I remember correctly). This is used in hacking - you can get the contents of the RAM after the computer has been shutdown.

permalink
report
parent
reply

Slightly misleading, the DRAM chips do that themselves so the kernel doesn’t have to do that.

permalink
report
parent
reply
6 points

Some very early systems did do it at kernel level, but yeah you are correct. Though I’d also consider the dram chips to be part of the computer and DRAM refresh makes up a good part of your phones battery consumption at standby.

permalink
report
parent
reply
4 points

If I remember, the decay of information in RAM is slower than that. This is an old memory, but I recall I think someone on TechTV talking about how you could, if fast enough, remove a module from one machine and put it in another, and if done right, potentially get the information off it.

permalink
report
parent
reply
1 point

From what i’ve read it’s temperature dependent, and at room temp some dram cells might take as long as 10 seconds to decay. The 64mS refresh is a super conservative call because it’s really bad when random bits go missing out of memory. The decay is faster at high temperatures, but some dram controllers might actually adjust based on temperature.

permalink
report
parent
reply
3 points

It’s possible, and can be done at home. You need to literally freeze the RAM very quickly (typically with CO2) and transfer it to the new system. Then you dump the contents of the stick and hopefully find an encryption key.

permalink
report
parent
reply
4 points

I don’t know exactly, but I wonder if it has to do with ram being volatile and ssds not being volatile?

permalink
report
reply
7 points

You’re on it.

With RAM the data is being stored as a voltage level continuously refreshed by computer. When the power is removed, the refresh voltage disappears, and the data it represents disappears. This is volatile storage. Infinite re-writes of the same bits, but data cannot persist without power always on it.

With NVRAM aka Non-volatile RAM (which is what SSDs are) data is being stored in a physical material. When data is written, the data represented by voltage differences, is used to make a physical change via chemistry to the material that makes up the SSD. This is also a MUCH slower process in NVRAM than updating data in real RAM. However the benefit is, because NVRAM is a physical change, you can remove power, and the data persists. When you power it back up, the data is read from the physical shape of the chemical material that makes up the NVRAM and then represented again as voltage differences when passed back to the computer.

The cost to this is there are only so many times that the chemical material can be changed. It wears out and is eventually no longer changeable.

permalink
report
parent
reply
1 point

It’s exactly that.

permalink
report
parent
reply
0 points

RAM needs a current to keep it’s data, if there is no power it will forget very fast. The SSD won’t forget anything if power fails.

To save re-writes you would have to have data that only resides in the RAM memory part of the SSD, which, again, is delicate. Also SSDs basically have this, a bit of more durable flash memory which acts as a write back cache.

permalink
report
reply

In a RAM you’re just trapping current in a loop inside a logical circuit and the state that you get, since it will be stable until it’s reset, is just a memorized 1 bit. You’re not changing anything physical there.

See: https://en.wikipedia.org/wiki/Memory_cell_(computing) (not an ELI5 though)

Wikipedia animation of a basic logical circuit that allows you to do that using NOR gates:

permalink
report
reply
3 points

That is static RAM (SRAM). Most RAM in computesr is DRAM, which works a bit differently and is much cheaper and denser, but more difficult to operate.

permalink
report
parent
reply
5 points

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.

permalink
report
reply

Explain Like I'm Five

!explainlikeimfive@lemmy.world

Create post

Simplifying Complexity, One Answer at a Time!

Rules

  1. Be respectful and inclusive.
  2. No harassment, hate speech, or trolling.
  3. Engage in constructive discussions.
  4. Share relevant content.
  5. Follow guidelines and moderators’ instructions.
  6. Use appropriate language and tone.
  7. Report violations.
  8. Foster a continuous learning environment.

Community stats

  • 1.4K

    Monthly active users

  • 80

    Posts

  • 1.5K

    Comments