4

This is follow up of Why does RAM have to be volatile ?. While the question answers why the computer main memory can not be non-volatile , it occur to me that Why can't we just back up the DRAM with a battery to preserve it's contents across boots.

But , since this technology is nonexistent , I wondered what were the reasons for the same.

So, What practical reasons are there for being unable to design a battery-backed main memory like those used in the CMOS and game-cartridges?

Note :I would like answers that illustrate the practical problems involved in designing such a system rather than comparing it to existing technologies like suspend / hibernate .

Ashildr
  • 2,770
  • 5
  • 28
  • 45

5 Answers5

4

Introducing a power source to RAM is called turning on a computer, what you're talking about is basically just leaving your computer on and pressing the sleep button.
Expanded Answer:
It has already been implemented to the extent current hardware allows, sleep mode shuts down all hardware non-essential to keeping the state of the computer in RAM, so the ideas are the exact same besides the concept of shutting down the machine. To actually reboot the machine into the previous state would rely on having some availible space left in RAM and MAJOR kernel modifications, so unless you reverse engineer the NT Kernel or commission Microsoft to create the feature the software itself makes it impossible.

3

Adding to what Slowki said, the reason why Sleep works is that you aren't rebooting.

The data in RAM only has meaning if you know what and where it is. As is, there is no explicit rule to, on boot, any program should store it's information anywhere on the RAM (there are of course exceptions).

If what you suggest (retaining RAM information between reboots) went into practice, the OS would have to come as a middle man between every program that was running and the information present in RAM. In order to do this, you would need to store the addresses of every piece of information in RAM and then tell the programs to access them.

This not only requires a full rewrite of memory allocation rules but a dangerous situation where the OS, and not the program, has responsibility for the program's state. Due to the difficult involved in this, and the current practices in programming, these are the reasons I point out for the unfeasibility of your proposal.

Sleep places your computer on a low-power state, such that the computer's state is stored. No RAM or disk activity should happen while the computer is Sleep-ing.

There is also the Hibernate function, where you, instead of using the volatile RAM, use instead a non-volatile storage (your HDD or SDD) to store the contents of the RAM. In this case you don't use any sort of power.

1

That idea could be detrimental. If you turned the computer off and the memory still kept its contents, then changing anything on the computer could be destructive.

Keltari
  • 75,447
1

As Hennes stated in his comment, RAM requires continuous refreshing not just power. In the days of simpler processors this was done by interleaving refresh cycles with data cycles on the system bus. So your battery backup idea could have been achieved by keeping the processor going. However, this was better known as leaving the power on, so it didn't catch on. Battery technology too was not as efficient, laptop batteries were bigger and heavier.

In more modern times, the processor contains a memory management unit to refresh the RAM. So your idea now requires keeping just one part of the processor - the MMU - on power. This would require a redesign of the processor.

Processors in mobile phones can do some very clever things with their power usage in order to maximise battery life. This includes selective powerdown of idle components. You could try constructing a PC using a phone processor.

All the above of course expects that all other components; HDD, screen etc. are powered down.

Judith
  • 673
  • 5
  • 18
1

Why not introduce a battery source to RAM to preserve its contents across boots?

Actually, your computer is already using battery-powered memory. Have you ever had to reset your BIOS settings when you couldn't boot the computer? There are two ways to do it: with the jumper or by removing the CMOS battery. That battery is used to power little amount of memory used to keep BIOS settings. It's not RAM, but it's close to what you're asking for - as you can see we're already using powered memory.

As of now we aren't using powered RAM because we have SSDs. Consumer-grade SSDs let you boot your OS in seconds and they are way cheaper than RAM. That's it when it comes to reading files from disk.

But SSDs are total game changers. So why weren't we using powered RAM before the SSD era? Because 20 GB (the size of my Windows folder) of HDD space costs $2.2 and 20 GB of DDR3 costs $220 (best offers from Newegg). If you can afford that, there are some options available.

I'm talking only about keeping files in RAM because with current hardware and software design, keeping state across reboots is impossible. Keltari has already posted that for example changing the graphics card could be destructive for the hardware or software. The same applies to performing disk modifications.

For example the same file in RAM and on hard disk could lose sync at some point if you take out the drive (or RAM) and mess around with some files). Checking if RAM files match disk files is as slow as simply reading from the disk, so it would defeat the purpose. You'd have to remember to reset RAM (like the CMOS battery thing) or create hardware systems that would do that, but they would require a power source too. Building such system is just hard, if not impossible.

And, finally, state is meant to be volatile - as the opposite to files, which should remain. That's how computers are designed. To change that, you'd have to rethink everything what we have come to since volatile RAM was first used in a computer.

gronostaj
  • 58,482