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,698
  • 5
  • 26
  • 45
  • 4
    How would this differ from the suspended state? – ernie Dec 17 '13 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 '13 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 '13 at 18:46
  • Related: [Why does RAM have to be volatile?](http://superuser.com/q/638675/194694) – gronostaj Dec 17 '13 at 19:03
  • To be practical, use sleep mode, not hibernate mode, that or go to Amazon, buy a nice SSD, and cut down on boot processes, either way you'll get better boot times. But other than that to implement a system with persistence in the RAM would require a modified kernel and BIOS. If you REALLY feel you need alot of speed, put multiple SSDs into a RAID array to leverage parrallel read-write. –  Dec 17 '13 at 19:26
  • @Slowki I am not just going to build a system with a backup battery for RAM but to understand the barriers in building such a system. – Ashildr Dec 17 '13 at 19:29
  • The barriers are that it is pointless and requires alot of software modification, which is why sleep mode was invented to hold the state in RAM and power down all non-critical systems. –  Dec 17 '13 at 19:31
  • @gronostaj Its not about RAM being volatile but the barriers in designing a system with battery backup for RAM. – Ashildr Dec 17 '13 at 19:37
  • @Ash I know, that's why I posted it in a comment as a related question instead of proposing it as a duplicate. – gronostaj Dec 17 '13 at 19:38
  • @Hennes ,could you please write them down as an answer ? – Ashildr Dec 17 '13 at 19:39
  • @mpez0 ,could you please write them down as an answer ? – Ashildr Dec 17 '13 at 19:41
  • @Ash To use better wording, this already exists, what sleep mode does is power everything down that's not needed to keep the state alive, and as Hennes points out, there are extra components needed, the only difference in sleep mode and "adding a battery" is the name and the idea of actually shutting down the computer. –  Dec 17 '13 at 19:43
  • *"hibernate loads memory images from hard disk which makes booting slow"* Well, not really. I have what many consider an "insane" amount of RAM in my PC: 32 GB. At an achievable 120 MB/s with spinning-platter HDDs, loading that back from disk will take about three minutes. Without having tested, that is also on the order of how long my system takes to boot, *without launching any particular utility applications, opening any documents, logging on to any web services, etc. etc.* Three minutes isn't that long. And you can always put the hibernation data on a SSD to speed things up... – user Dec 17 '13 at 19:46
  • Can you explain the difference between Sleep/suspended mode and what you propose? As is, they seem almost the same, except for the part where you state you want to **boot** from; In this instance I'm now somewhat confused as to what you are trying to achieve, besides speed. – Doktoro Reichard Dec 17 '13 at 20:04
  • 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](http://superuser.com/questions/689718#comment875932_689718) and [mpez0](http://superuser.com/questions/689718#comment875935_689718). 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 '13 at 02:51
  • @all, this is *not* an opinion-based question, nor a duplicate of the question about the volatility of RAM. This question is (clearly) asking why system RAM cannot have a battery backup in the same way as the CMOS and game-cartridges can. The answer has nothing to do with software, and does not have to be guessed at. The answer would include some math and tech about how (modern) RAM functions (refresh cycles, etc.) and quantity (number of NAND cells, etc.) and an analysis of the power requirement of a battery to keep them alive and comparison to common (non-laptop) battery capacities. – Synetech Dec 18 '13 at 02:57
  • @Ash, also check out Gigabyte Technology’s [i-RAM](http://www.gigabyte.com/products/product-page.aspx?pid=2180#ov) [module](http://techreport.com/review/9312/gigabyte-i-ram-storage-device). – Synetech Dec 18 '13 at 03:00
  • @Synetech I am not at all satisfied with the answers and closest expected answers were hennes's and mpez0's comments.The thing is that everyone (most of them ) tend to compare it with existing technology (like suspend /hibernate )rather than discussing the barriers in designing a system backed with battery.Since, my primary language is not English , I hope, I am not able to structure it in a way that everyone understands. – Ashildr Dec 18 '13 at 12:28
  • @Synetech If you could , Can you please mention some points in tweaking the question ? – Ashildr Dec 18 '13 at 12:29
  • 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 http://forums.techarena.in/motherboard-processor-ram/1125600.htm – Carl B Dec 18 '13 at 14:58
  • @CarlB Technically it's a RAM Disk, and you can do stuff like that with your own PC. – Doktoro Reichard Dec 18 '13 at 15:01
  • @Ash I and Slowki mentioned Sleed/Hibernating because, when this question was at it's beginnings, you didn't mention some things that now seem clearer. As the technology does exist (to store data indefinitely on RAM) we answered accordingly. ***Now***, I can tell you that the same post you now link has probably the answers you seek: namely rewrite cycles and reliability, which are lower on CMOS (or non-volatile) memory. – Doktoro Reichard Dec 18 '13 at 15:05
  • @DoktoroReichard - agreed. My point was that there was independent powered volatile RAM concepts in the market place, but indeed, this is a ram disk. – Carl B Dec 18 '13 at 15:05
  • Probably the point that is confusing me the most is the booting part. If we assume we can keep RAM turned on indefinitely, the only parts we would need to keep pinned down on the RAM would be the OS kernel, drivers and other loader issues. This would imply some rewriting of the OS, but it wouldn't stop with how OS are loaded. Essentially, you can't (shouldn't) rely on RAM. – Doktoro Reichard Dec 18 '13 at 15:10

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
    Emphasis on the Sleep function. – Doktoro Reichard Dec 17 '13 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 '13 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. – Doktoro Reichard Dec 17 '13 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. –  Dec 17 '13 at 19:55
  • Slowki, @DoktoroReichard - this is an open question about computers in general, not necessarily computers we know today. OP is asking why they were designed to work with volative RAM instead of powering it from batteries. Just open your minds and stop sticking to today's PCs and saying "*it's a sleep state*" - it's not, you could build a computer from scratch and give it battery-powered RAM! Or maybe not? That's what OP has asked! Please watch [this video](http://vimeo.com/71278954) as a homework ;) Or if you're busy you can start watching at 29:22, it's an important lesson. – gronostaj Dec 17 '13 at 20:23
  • 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. –  Dec 17 '13 at 20:36
  • @gronostaj If you start thinking about possibilities (and future ones, at that) then I tell you *everything is possible, given enough time*. Someone can make such a system, maybe in 1 million or 2 million years. Or maybe tomorrow, who knows. As we are supposed to give *practical* answers, and not *hypothetical* ones, hence we are sticking to the PC as we know it. If the OP asked the following: "Is it possible to build a computer (a machine that makes calculations) whose RAM is battery-powered" then the answer is always yes. – Doktoro Reichard Dec 17 '13 at 20:52
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.

Doktoro Reichard
  • 5,390
  • 5
  • 35
  • 42
  • 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. –  Dec 17 '13 at 19:03
  • @Slowki you can add the above details also to your answer.They states valid points. – Ashildr Dec 17 '13 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.

Keltari
  • 71,875
  • 26
  • 179
  • 229
  • 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 '13 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.

Judith
  • 673
  • 4
  • 18
  • 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. – Doktoro Reichard Dec 17 '13 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 '13 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. – Andreas Bombe Dec 17 '13 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.

gronostaj
  • 55,965
  • 20
  • 120
  • 179
  • 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) – Doktoro Reichard Dec 17 '13 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 '13 at 21:04
  • @DoktoroReichard just out of curiosity, what kind of memory is used to keep BIOS settings? – gronostaj Dec 17 '13 at 21:08
  • It's [a form of ROM](http://en.wikipedia.org/wiki/BIOS#Chips). Also, the examples you gave, although valid, aren't all that common. – Doktoro Reichard Dec 17 '13 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 '13 at 21:56
  • Good catch. This article might have better references than the one I linked. [NVRAM](http://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory), which, as the article states, is actually a misnomer, is what stores the BIOS settings. It's a misnomer because memory evolved (to really be nonvolatile) to the point the battery only is required to run the RTC. Also, the term RAM is usually used when there can be free access to any address; that's not the case with BIOS, where every address is assigned a specific function. But this is me nitpicking. – Doktoro Reichard Dec 17 '13 at 22:04