The Computer Oracle

Why does RAM have to be volatile?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind

--

Chapters
00:00 Why Does Ram Have To Be Volatile?
00:18 Answer 1 Score 6
02:06 Accepted Answer Score 118
04:14 Answer 3 Score 23
05:27 Answer 4 Score 18
06:57 Thank you

--

Full question
https://superuser.com/questions/638675/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#memory #ramdisk

#avk47



ACCEPTED ANSWER

Score 118


When most people read or hear "RAM", they think of these things:

Two SDRAM sticks, courtesy of Wikipedia

Actually these are made of DRAM chips, and it's controversial if DRAM is a kind of RAM. (It used to be "real" RAM, but technology had changed and it's more of a religious belief if it's RAM or not, see discussion in the comments.)

RAM is a broad term. It stands for "random access memory", that is any kind of memory that can be accessed in any order (where by "accessed" I mean read or written, but some kinds of RAM may be read-only).

For example HDD isn't a random access memory, because when you try to read two bits that aren't adjacent (or you're reading them in reverse order for whatever reason) you have to wait for the platters to rotate and the header to move. Only sequential bits can be read without additional operations in between. That's also why DRAM can be considered non-RAM - it's read in blocks.

There are many kinds of random access memory. Some of them aren't volatile and there are even read-only ones too, for example ROM. So non-volatile RAM exists.

Why don't we use it? Speed isn't the biggest problem as for example NOR Flash memory can be read as fast as DRAM (at least that's what Wikipedia says, but without citation). Write speeds are worse, but the most important issue is:

Because of the inner architecture of non-volatile memory, they have to wear out. The number of write-and-erase cycles is limited to 100,000-1,000,000. It looks like a great number and it's usually sufficient for non-volatile storage (pendrives don't break that often, right?), but it's an issue that already had to be addressed in SSD drives. RAM is written way more often than SSD drives, so it would be more prone to wearing.

DRAM doesn't wear out, it's fast and relatively cheap. SRAM is even faster, but it's also more expensive. Right now it is used in CPUs for caching. (and it's truly RAM without any doubt ;) )




ANSWER 2

Score 23


It should be noted that the first commonly-used "main store" in computers was "core" -- tiny toroids of ferrite material arranged in an array, with wire running through them in 3 directions.

To write a 1 you'd send equal strength pulses through the corresponding X and Y wires, to "flip" the core. (To write a zero you wouldn't.) You'd have to erase the location before writing.

To read you'd try to write a 1 and see if a corresponding pulse was generated on the "sense" wire -- if so the location used to be a zero. Then you'd of course have to write the data back, since you'd just erased it.

(This is a slightly simplified description, of course.)

But the stuff was non-volatile. You could shut down the computer, start it up a week later, and the data would still be there. And it was most definitely "RAM".

(Before "core" most computers operated directly off a magnetic "drum", with only a few registers of CPU memory, and a few used stuff like storage CRTs.)

So, the answer as to why RAM (in it's current, most common form) is volatile is simply that that form is cheap and fast. (Intel, interestingly enough, was the early leader in developing semiconductor RAM, and only got into the CPU business to generate a market for their RAM.)




ANSWER 3

Score 18


DRAM is fast, can be built cheaply to extremely high densities (low $/MB and cm2/MB), but loses its state unless refreshed very frequently. Its very small size is part of the problem; electrons leak out through thin walls.

SRAM is very fast, less cheap (high $/MB) and less dense, and does not require refreshing, but loses its state once the power is cut. The SRAM construction is used for "NVRAM", which is RAM attached to a small battery. I have some Sega and Nintendo cartridges which have decades-old save states stored in NVRAM.

EEPROM (usually in the form of "Flash") is non-volatile, slow to write, but cheap and dense.

FRAM (ferroelectric RAM) is one of the new generation storage technologies that's becoming available that does what you want: fast, cheap, nonvolatile...but not yet dense. You can get a TI microcontroller that uses it and delivers the behaviour you want. Cutting power and restoring it allows you to resume where you left off. But it only has 64kbytes of the stuff. Or you could get 2Mbit serial FRAM.

"Memristor" technology is being researched to deliver similar properties to FRAM, but is not yet really a commercial product.


Edit: note that if you have a RAM-persistent system, you either need to work out how to apply updates to it while it's running or accept the need for the occasional restart without losing all your work. There were a number of pre-smartphone PDAs which stored all their data in NVRAM, giving you both instant-on and the potential instant loss of all your data if the battery went flat.




ANSWER 4

Score 6


IMO the main problem here is indeed volatility. To write fast, writing has to be easy (i.e. not require extended periods of time). This contradicts what you'd like to see when selecting RAM: It has to be fast.

Everyday analogy: - Writing something on a whiteboard is very easy and takes little to no effort. Therefore it's fast and you can sketch all over the board within seconds. - However, your sketches on the whiteboard are very volatile. Some wrong movement and everything is gone. - Take some stone plate and engrave your sketch there - like The Flintstones style - and your sketch will stay there for years, decades or possibly centuries to come. Writing this takes a lot longer though.

Back to computers: The technology to use fast chips to store persistent data is already there (like flash drives), but speeds are still a lot lower compared to volatile RAM. Have a look at some flash drive and compare the data. You'll find something like "reading at 200 MB/s" and "writing at 50 MB/s". This is quite a difference. Of course, product price has some play here, however, general access time might improve spending more money, but reading will still be faster than writing.

"But how about flashing BIOS? That's built in and fast!" you might ask. You're right, but have you ever flashed a BIOS image? Booting through BIOS takes just moments - most time is wasted waiting for external hardware - but the actual flashing might take minutes, even if it's just a few KByte to burn/write.

However, there are workarounds for this issue, e.g. Windows' Hybernate feature. RAM contents are written to a non-volatile storage (like HDD) and later on read back. Some BIOS on netbooks provide similar features for general BIOS configuration and settings using a hidden HDD partition (so you essentially skip the BIOS stuff even on cold boots).