2
\$\begingroup\$

I understand the basics of volatile and nonvolatile memory. Volatile memory requires a constant power supply to retain data whereas non-volatile memory does not require a constant power supply to retain data. What I would like to know is this: are there any other major differences in terms of performance, speed, size etc? In addition, what uses do each play in a computer? Lastly, how does each work? Thanks in advance for all answers and comments.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ RAM is volatile (when you turn off the computer, it is cleared), but your hard disk is non-volatile (you still have the data when you turn back on) \$\endgroup\$
    – apnorton
    Jun 18, 2013 at 13:26

2 Answers 2

7
\$\begingroup\$

Yes, you understand the definition of volatile and non-volatile memory. From that alone you'd think non-volatile is always better. However, in the real world that is not true since the different technologies for making these memories cause other attributes to appear beyond volatileness.

Tradeoffs that various different memory technologies force on us include:

  1. Read speed.

  2. Write speed.

  3. Cost.

  4. Size.

  5. Power consuption when idle, reading, and writing.

  6. Operating lifetime.

  7. Number of lifetime reads or writes.

and that's just what came to mind quickly. Obviously, the ideal memory is fast to read, fast to write, costs little, is small, takes little power, lasts a long time, and can be used many times. There is no one technology that does a good job in all these areas together. Volatileness is just one more entry in the list of parameters to consider.

In something like a microcontroller intended to be embedded into a circuit that needs to turn on quickly, having the main program memory be non-volatile is imortant. That today generally means it will be slow to write, have a finite number of lifetime writes, and will forget its content after a few 10s of years. Obviously we'd like to not have these drawbacks, but nobody knows how to make a memory that doesn't have them for the size and cost required in a micro.

The data memory in a micro could be arbitrarily written and read in a loop millions of times in seconds, possibly going on for years, so a technology that doesn't have a finite number of lifetime reads or writes is important. To get that, we give up the ability to retain the values when power is removed.

There are all kinds of memory technologies that optimize some of these parameter, inevitably at the expense of others. Some common technologies:

  • CMOS static RAM. These are really logic circuits optimized to hold bits. They are fast, have effectively infinite lifetime reads and writes, take little power when not being accessed, and have a long operating lifetime. On the other hand, this memory is volatile, and the cells are relatively large, which makes them expensive with high densities not attainable.

  • EEPROM. Actually that's not strictly speaking a technology, but today (this could easily change) these memories are commonly implemented with floating gate MOSFETs. Their main attribute is that they are non-volatile. Density is high, so cost is low, but they get physically worn out a little bit every time the charge on the gate is changed, which is what writing or erasing does.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Related to 6 (Operating lifetime) is the complexity of wear-leveling (and ECC). Related to 2 (write speed) are write buffering requirements. Other issues include read/write/erase granularity and error resilience (I think MRAM is more popular in aerospace for its resilience to radiation). Manufacturing compatibility with logic processes is also a factor. \$\endgroup\$
    – user15426
    Jun 18, 2013 at 14:35
  • 1
    \$\begingroup\$ Another possible pattern is to use a static RAM in combination with a flash or EEPROM, and make sure that there will at all times be enough energy stored in capacitors to write everything important that's in RAM to the flash or EEPROM. Some chips or modules take care of this automatically; it's also possible to manually use a combination of devices, though in the latter situation one needs to be careful to guard against possible disruptions other than a simple power-down. \$\endgroup\$
    – supercat
    Jun 18, 2013 at 15:25
  • \$\begingroup\$ Also, loosely related to 1 (Read speed) is whether reads are destructive (one can have a nonvolatile memory with destructive reads!). @supercat nvSRAM is SRAM backed by NV memory with a capacitor to provide writeback on loss of power. (I had to look up "nvSRAM"--it is mentioned in gman's answer.) \$\endgroup\$
    – user15426
    Jun 18, 2013 at 22:19
3
\$\begingroup\$

FRAM/MRAM/nvSRAM are NV memories that offer good speed (serial or parallel interface) and offer high endurance and long retention times. I would classify these in one bucket.

EEPROM/flash are in a different bucket. EEPROM are byte-writeable, higher endurance, slightly faster than flash equivalents. Both are floating gate technologies. But flash implements the cells in a much more compact fashion than EEPROM which causes some limitations, namely erase before write, and writes need to be a minimum block size. There's even more - NOR vs NAND flash. NOR is higher speed, NAND is what gets used in 99% of consumer electronics (phones/SSD/cameras). Where flash shines is density and lower price-per-bit.

SRAM/DRAM are in the volatile "RAM" bucket. When power is removed, you lose your data (unless you super-cool the memory). No endurance limits. While power is applied, SRAM data does not need to be refreshed whereas DRAM cells need refreshing (tens of millisec), otherwise the charge leaks away.

From a user point of view, the lower density memories (SRAM/EEPROM/FRAM/MRAM/nvSRAM) are much easier to use. The most bang for your buck (DRAM/flash) requires more work. Remember there's an 8051 MCU built into each flash memory. And with DRAM, think of the data as balls being juggled.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.