Computer memory comes with many different distinctions. One of the ones you may have seen is volatile memory vs. non-volatile memory. The word volatile means something that is transitory or is likely to change. In computing, it refers to types of memory that can’t retain data when they lose power. Conversely, non-volatile memory retains its data, even if it doesn’t have a power supply.
How Does It Work
It’s important to note that volatile memory doesn’t delete data when it loses power. No delete operation goes through and wipes the volatile memory as your computer shuts down. Volatile memory is simply incapable of holding the electric charge to store data without a constant power supply. It’s also worth noting that different non-volatile memory can lose data over time. For example, when unpowered, the charge used to store data in SSDs slowly decays. This results in data loss after a couple of years without power.
Non-volatile memory is ideal for long-term storage. You probably won’t be surprised to hear that your hard drive uses non-volatile memory. SSDs, HDDs, optical storage media, and magnetic tape are all forms of non-volatile memory. Technically, you could consider the classic punch cards. Or printed paper, a form of non-volatile memory. However, you don’t use them that way.
Volatile memory loses any data it holds when it loses power. This makes it useless for long-term storage. As any power cut would mean losing your data. There are uses for volatile memory in computers, though. System RAM is volatile. It holds data while the computer is on. Then loses it when it turns off. The caches on the CPU die are also volatile memory.
In both cases, losing the data when power is cut perfectly fine as it is stored on the non-volatile RAM. In fact, RAM and CPU cache should lose data when the computer shuts off. This ensures that the data they hold is adequately cleared and not vulnerable to data recovery when shut down. Any necessary data can easily be stored in the volatile memory again by reading it from the non-volatile memory.
The main benefit of non-volatile memory is its ability to store data while unpowered. There are other benefits. Non-volatile memory is typically cheaper than volatile memory per unit of memory. This is particularly useful as you need large amounts of non-volatile storage space to store your data long-term.
Non-volatile memory keeps its data when powered down, making it vulnerable to data recovery. This is good, as it allows you to recover data from a broken hard drive.
Another helpful thing your non-volatile memory can use is pre-saving files that haven’t been saved. Suppose you’ve ever been writing a document in Word – a letter or paper, for example – and have had a power cut or your computer blue screen. You know the panic that follows as you realize that you’ll have to re-do the work because you never saved it.
Thankfully, word, and other programs, often pre-saves a temporary file to your hard drive before you manually save it. This allows you to recover your “lost” document after a reboot. This wouldn’t be possible in a computer with no non-volatile memory as the data would be lost entirely.
Non-volatile memory is typically slower than volatile memory. But that’s why volatile memory is used in speed-sensitive places such as RAM and CPU cache. Not all volatile memory is faster than all non-volatile memory. It would be crushed if you took RAM from the earliest computers and compared it to a modern SSD. But that’s not a fair comparison. Technology and connectivity have significantly improved over time.
Non-volatile memory is actually slower than volatile memory in two different ways. It is slower to read or write data but has a much higher latency. Latency measures how long it takes for the memory to find and respond to the requested data. The read or write speed is the actual transmission rate of data.
Non-volatile isn’t ideal for storing data that needs to remain secure, as that data can be recovered forensically. This is an unavoidable risk for sensitive data that must be stored long-term. Though it can be countered with encryption. For sensitive ephemeral data, though, you don’t want to use non-volatile memory.
For example, temporary encryption keys, such as those used in HTTPS encryption, are stored in RAM. You don’t need these again once you power off your computer, as you can just negotiate new encryption keys. Suppose you have had these keys for a long time. In that case, they could be vulnerable to data recovery and used to decrypt and spy on your network traffic.
Another downside of non-volatile memory is that you actively have to delete data from it if you want to ensure it’s wiped. If you forget this when reselling an old drive, the new owner may be able to access your saved data.
Non-volatile memory is a critical part of any computing device. Without it, you wouldn’t be able to save anything permanently. All data would be vulnerable to being lost if the power was ever cut. Any form of long-term data storage, such as HDDs, SSDs, CDs, DVDs, ROM, and magnetic tape, is non-volatile. Share your thought in the comments below.