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 .

24
  • 4
    How would this differ from the suspended state?
    – ernie
    Dec 17, 2013 at 18:39
  • 2
    The RAM would need to be refreshed, so you would also need to power the memory controller. These days that is part of the CPU, so part of that might need to stay powered on. And to deci Watts. I measured a 2-3 Watt increase per extra DIMM installed (DDR3-533MHz, ona i920/X58 board).
    – Hennes
    Dec 17, 2013 at 18:39
  • 3
    Probably your definition of "negligible" doesn't match the actual consumption vs battery capacity vs time. Assuming 10W and 1000 hrs of standby, you need a 10 KW battery, which is about 4 "C" size NiMH, plus charging circuitry, voltage conversion, etc. Of course, one could just use static RAM and have no battery consumption when off.
    – mpez0
    Dec 17, 2013 at 18:46
  • 1
    @Ash, are you satisfied with the proposed answers below? I for one am not. The closest that anyone has come to answering the question satisfactorily are the comments by Hennes and mpez0. Those actually address the question of what practical reasons there are for being unable to make battery-backed memory like those used in the CMOS and game-cartridges. The answer being that the makeup and quantity of modern RAM makes it too power-hungry to use a small battery like that.
    – Synetech
    Dec 18, 2013 at 2:51
  • 1
    This is not a new concept an older item that never really took hold (cost prohibitive and small GiB size) is an item from Acard forums.techarena.in/motherboard-processor-ram/1125600.htm
    – Carl B
    Dec 18, 2013 at 14:58

5 Answers 5

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.

7
  • 3
    Emphasis on the Sleep function. Dec 17, 2013 at 18:41
  • 1
    -1. The question is about powering RAM from a battery, which is not sleep mode. Put your computer to sleep, unplug the power cord and see if RAM will be preserved. Laptops are considered cheating ;)
    – gronostaj
    Dec 17, 2013 at 19:52
  • @gronostaj consider sleep mode as an equivalent of "low-power state". Laptops don't have that problem because they can power themselves for a moment. In your case how would you preserve RAM in a desktop without the power cord? Answer: a battery of sorts. Dec 17, 2013 at 19:54
  • 1
    @gronostaj The question is about providing power to the RAM to preserve the state and save boot time, I make no mention of power supply, so putting it to sleep and swapping the PSU for a battery would still work.
    – user270595
    Dec 17, 2013 at 19:55
  • 1
    @gronostaj The question is about saving computer state in RAM and "practicality of implementing such a backup source" practicality refering to adapting this to the modern PC, I simply made the point that why would you ever shut the PC down when you want to save the state when you can preserve power by using the sleep function. I also mentioned potential roadblocks to creating a save state on shutdown because he also asked about that.
    – user270595
    Dec 17, 2013 at 20:36
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.

2
  • Good job on the thoroughness of your answer. Another point though would be that it would require a re-write of all modern OS Kernels just to handle idea of RAM already being populated on boot, and I'm not even sure if the BIOS itself could handle it. Plus if the state saved was at 100% RAM usage then there would be data-loss just to get the BIOS/Kernel/Init-Systems loaded into RAM.
    – user270595
    Dec 17, 2013 at 19:03
  • @Slowki you can add the above details also to your answer.They states valid points.
    – Ashildr
    Dec 17, 2013 at 19:43
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.

1
  • 1
    While this is a valid objection, presumably if one did something like what the OP is asking for, there would be a way to actually shut the system down. Much like ATX PSUs often have a switch at the back that actually turns them off, rather than just setting them to a power-off power state.
    – user
    Dec 17, 2013 at 18:53
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.

3
  • But the problem is that using a phone processor (aka an ARM processor) implies 2 things. An OS that was written for the ARM platform and apps to go with it. This being said, Windows 8 RT is just that. Dec 17, 2013 at 19:43
  • Good point @Doktoro Reichard. The PC is more than just the hardware, the OS has to handle it. I've also seen some Samsung & Asus phones that can be docked like a laptop, which is not too dissimilar an approach.
    – Judith
    Dec 17, 2013 at 19:48
  • This answer is wrong on a couple of things. The MMU translates virtual addresses to physical addresses and enforces access restrictions. It does not refresh DRAM, that's silly, not to mention that it is removed from DRAM by a few levels of cache. It's the memory controller's job to interface to DRAM and perform refreshes. Only in recent years have the memory controllers actually been integrated into the CPUs. Also, all the SDRAM generations support powerdown modes with self-refresh which requires nothing of the memory controller but hold a few control lines at a defined level. Dec 17, 2013 at 22:50
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.

6
  • The first paragraph is incorrect, in the sense BIOS doesn't need to "randomly access" it's memory. Also, the second last paragraph doesn't make a lot of sense, as RAM and hard drives weren't usually designed to be removed (there was a good post about hotplugging though) Dec 17, 2013 at 20:54
  • @DoktoroReichard I'm not talking about removing hard disk from a running system, but removing it in general. For example if you want to use it to move some data from one PC to another and then connect it back. Or you could "borrow" RAM when diagnosing RAM problems with another PC.
    – gronostaj
    Dec 17, 2013 at 21:04
  • @DoktoroReichard just out of curiosity, what kind of memory is used to keep BIOS settings?
    – gronostaj
    Dec 17, 2013 at 21:08
  • It's a form of ROM. Also, the examples you gave, although valid, aren't all that common. Dec 17, 2013 at 21:45
  • @DoktoroReichard I guess that link applies to the memory that houses the BIOS itself, not BIOS settings. I believe they are kept in some kind of volatile memory, otherwise the battery trick wouldn't work. Anyway, I've edited the first paragraph.
    – gronostaj
    Dec 17, 2013 at 21:56

Not the answer you're looking for? Browse other questions tagged .