If you are a consumer buying parts for your PC or a student of computer systems, you may have come across an important term called “Volatile Memory” particularly in relation to the RAM sticks. What is volatile memory and why RAM is called volatile memory?
In simplest of words, a volatile memory is basically a memory type that looses its data when it stops receiving electrical power. RAM is called volatile memory because it does not store data permanently as it only stores it while it is still receiving power. When you switch off your PC, the RAM looses all of its data.
But RAM isn’t the only volatile memory in your PC, you also have the CPU cache memory that is also volatile. But an other important topic to discuss is the difference between volatile and non-volatile memory.
In the following article I will talk in detail about RAM and why it is considered a volatile memory and also compare it with other storage mediums.
So Why RAM is Called Volatile Memory?
RAM is called volatile memory because they loose their data when the electrical power is turned off.
When you shut down your PC or when a PC turns off abruptly, all the DATA stored in RAM is lost.
Therefore, the DATA stored in RAM is temporary.
Volatile Memory vs Non-Volatile Memory
The key difference between volatile and non volatile memory is that the former looses data when the power is turned off while the latter retains its data even when the power is turned off.
The following table summarizes all the important differences between volatile and non-volatile memory:
|Retains data only while power is being supplied||Retains data even if the power is turned off|
|Primary Memory - a computer cannot function without this||Secondary Memory|
|DATA is accessed and manipulated by the CPU here||DATA is first copied to RAM and then manipulation and processing can occur,|
|Capacity is often small ranging from 8-32 GBs||Capacity is very large often in multiple TBs|
|Very fast transfer rates|
DDR 4 (3200MHz) has transfer rate of about 25.6 GB/s
|Slower transfer rates. The best and expensive Gen 4 NVMe SSDs have transfer rate of about 5.5 GB/s|
Volatile memory is also called the primary memory because a computer cannot work without it. The manipulation or actual processing of data by the CPU occurs here.
Volatile memory is also very fast. A good DDR4 RAM can reach speeds of about 25.6 GB/s, whereas, even the best and expansive SSDs (Such as Samsung 980 Pro) can reach speeds of about 5.5 GB/s only. A typical hard disk drive has speeds of only abut 200 MB/s!
The secondary memory, or the non volatile memory such as hard drives and SSDs, are simply known as “Storage Drives” by consumers.
Examples of Volatile and Non-Volatile Memory
The following table shows the examples of volatile and non volatile memory.
|Types of Memory||Type||Purpose||Speeds|
|RAM||Volatile||The primary memory for processing and manipulation of data||DDR 4 - 25.6 GB/s
|Cache||Volatile||The fastest and the most expensive memory; located very close to the CPU and is used to perform lightning fast manipulation of data.||10-100 times faster than RAM|
|Hard Disk Drives||non-volatile||Most common storage medium for large amount of data||200 MB/s at best|
|Solid State Drives||non-volatile||A faster secondary storage. Can improve the PC performance drastically.||upto 5500 MB/s with Gen 4 NVMe SSDs|
|USB Drives |
|non-volatile||Fast portable storage||upto 500 MB/s with USB 3.1|
|CDs/DVD/Blu-RAY||non-volatile||Slow portable storage||72 MB/s with Blu-Ray (fastest discs)|
Explaining Volatile Memory with a Scenario
Whenever you perform any task on your PC be it playing a song, watching a movie, or copying and pasting files, the PC first fetches the data from the non-volatile Hard Drive and stores it in the volatile RAM for processing.
So if you were watching a movie and you decide to turn off your PC abruptly, then in the next startup, your PC will not start from where you left off.
Your media player, the movie that you were playing and anything else open in the background before you had turned-off your PC would not be returned back to their previous state and your operating system would start anew.
So while your hard drive still has the movie file, the temporary data of it playing is now removed.
Why is Primary Memory Volatile?
For starters, know that primary memory of a computer, or RAM, DOES NOT HAVE TO BE VOLATILE. It is just how the modern systems are currently designed because of the higher speeds of volatile RAM technology.
This is because the cells or the circuitry of a RAM module is fairly simple. At the basic unit RAM is made up of series of SR latches and flip flops which use relatively simple circuitry and are dependent upon power being supplied.
On the left hand side on the image above you can see the diagram of what an SR latch looks like with NOR logic gates. On the right hand you can see its truth table.
The truth table shows the state of the output terminals (Q and Q-bar) when a signal is received at either of the input terminals i.e S (Set) and R (Reset).
The SR latch represents ONE BIT of memory. Here essentially, when an electrical signal is received at the Set (S) terminal, 1 bit of memory is stored. The Set (S) terminal is electrical supply side.
The Reset (R) terminal is the 0V terminal meaning when this terminal is high (set to 1), no memory is stored.
Hence, given the simplicity of their design, volatile memory tend to be very fast and hence are the choice for primary RAM (as mentioned 25.6 GB/s transfer speed for DDR4).
On the other hand, you have the non-volatile memory such as Hard Disks. These use spinning magnetic platters. Given their mechanical nature, they are very slow. In order to store or retrieve data, the header first has to move, locate the right disk platter and then the right track and then the right sector.
By the time a hard disk can store a single bit of data, a RAM could have stored millions of bits already.
If a CPU was to use a Hard Disk as the primary drive, then performing a simple task such as opening a file would take hours.
You also have the SSDs now, which unlike the Hard Disks, are electronic in nature and use a similar principle of latches as the RAMs do. However, given the fact that SSDs have to STORE the data even if the power is switched of, their circuitry is more complex.
Complex circuitry means data processing will take longer. As such even the best SSDs are nowhere close to the speeds of a RAM sticks.
It wouldn’t make sense to have a super fast CPU, only to get seriously bottlenecked by a slow working primary memory.
TLDR; Primary memory CAN be non-volatile. However, since all formats of non-volatile memory at the moment are slow, they are not the best choice for storing temporary data for CPU manipulation.
So why RAM is called volatile memory? It is called volatile memory because it does not retain data when the electrical power is turned off.
But as mentioned, technically RAM can also be non-volatile. However, doing so will make the primary RAM very slow thus bottlenecking the CPU and the rest of the system performance.
Perhaps there will come a time when non-volatile memory type will surpass the performance of volatile memory, but for now RAM remains volatile.