Memory is an essential component of a computer. Without memory, your computer cannot retrieve your precious memories, help you deal with your work, or even run programs that maintain their systems. Storage devices (i.e., computer memory resources) can retain data reliably for long periods of time, and they are also used to store variables that are quickly read and edited throughout the execution of a program. How does computer memory work? Let’s find out in this article.
Primary and Secondary Memory
Like humans, computers also have short-term and long-term memory, called primary and secondary memory, respectively. Primary memory can be accessed very quickly but often has limited storage spaces. On the other hand, secondary memory can store much more information, but it often takes longer for data to be retrieved from them.
What are the types of primary memory and secondary memory in your computer? The best-known type of primary memory is the RAM, the place where variables in programs are stored to be directly and quickly retrieved by the CPU. RAM stands for random access memory, which means each location can be accessed at the same speed as all the others. This is unlike hard drives, where the disk has to spin to the position of the data for it to be read or written by relatively stationary read-write heads.
To improve performance, there is also a cache inside the CPU itself, which is even faster than RAM but can only store a minimal amount of information. It is often used to hold data that is currently being manipulated.
In contrast, secondary memory is mostly for holding multitudes of information but is not optimized for speed compared to primary memory devices. Storage devices inside this category include the hard drive, the SSD, and external drives such as USBs.
Volatile and Non-volatile Memory
Other than primary and secondary memory, storage devices can also be classified based on whether they are volatile. Volatile memory, like RAM and the CPU cache, can only retain data when it’s powered on. When the power supply is cut, all data inside the memory is lost.
Therefore, if you want to keep data over long periods of time and when a computer is shut down, you need to move the data to non-volatile memory. They are often secondary storage devices like the hard drive that maintains information by methods other than moving electric currents.
How Does Computer Memory Work?
After classifying memory resources and finding out about the major differences between different types of storage devices, it’s time to learn how they actually work (i.e., how they can retain data). But there’s one thing in common: They all store data in binary digits, or bits, that can only take on the values of 0 and 1.
The RAM inside your device is dynamic RAM (a.k.a. DRAM). They are volatile because the data is literally stored through electric charges. Specifically, each memory cell has many capacitors. A capacitor either hold a charge or does not. If a charge is present, the bit is encoded as 1; otherwise, it’s interpreted as 0.
Things work differently when you talk about secondary memory, as they have different mechanisms of storing data. We’ll first introduce how hard drives, which consists of a spinning platter and a read-write head, work. Information is basically stored as magnetic charges on the hard drive’s platter. By this design, a hard drive’s read-write head has to spin towards the location of the data in order to read from or write to it, causing hard drives to be much slower than RAM. In addition, since the read-write head of hard drives are so close to the platter’s surface, it is also susceptible to head crashes, in which the head collides with the platter, permanently erasing the data in the affected area and potentially causing a hardware failure.
A faster alternative to hard drives are SSDs. They work using flash memory, which uses memory chips and electric currents to store data. Unlike RAM, flash memory does not require a continuous power supply and can thus retain data even when the computer is turned off. Unlike hard drives, SSDs don’t have moving parts, so there’s no risk of mechanical failure there. However, repeatedly writing to a memory cell causes it to degrade, and eventually making it unusable. As a result, SSDs have a limited lifespan compared to hard drives if you write to them very frequently.
In this article, we’ve mentioned the classifications of computer memory and how different types of computer memory works. If you want to learn more about related things, please visit the webpages in the references below.
1. TED-Ed. (2016, May 10). How computer memory works – Kanawat Senanan. Retrieved September 11, 2022, from https://www.youtube.com/watch?v=p3q5zWCw8J4
2. Jeff Tyson. (n.d.). Computer Memory Basics. Retrieved September 11, 2022, from https://computer.howstuffworks.com/computer-memory1.htm
3. Chris Woodford. (n.d.). How does computer memory work? Retrieved September 11, 2022, from https://www.explainthatstuff.com/how-computer-memory-works.html
4. Stephen St. Michael. (2019, August 1). Introduction to DRAM (Dynamic Random-Access Memory). Retrieved September 11, 2022, from https://www.allaboutcircuits.com/technical-articles/introduction-to-dram-dynamic-random-access-memory/
5. (n.d.). What is Cache Memory? Cache Memory in Computers, Explained. Retrieved September 11, 2022, from https://www.techtarget.com/searchstorage/definition/cache-memory
6. (n.d.). Cache – CPU and memory – GCSE Computer Science Revision – BBC. Retrieved September 11, 2022, from https://www.bbc.co.uk/bitesize/guides/zmb9mp3/revision/3
7. (n.d.). Definition of head crash – PCMag. Retrieved September 11, 2022, from https://www.pcmag.com/encyclopedia/term/head-crash
8. William Harris. (n.d.). How Hard Disks Work – Computer. Retrieved September 11, 2022, from https://computer.howstuffworks.com/hard-disk.htm
9. Joel Lee. (2022, March 5). How Do Solid-State Drives Work? Retrieved September 11, 2022, from https://www.makeuseof.com/tag/solidstate-drives-work-makeuseof-explains/