The CPU inside a computer works with the help of electric current. When the electric current is high, we interpret it as “1” and when the current is low, we interpret it as “0”. For example, for a computer, the digit 10 is 1010.
So, if you want your computer to multiply 10 by 10, this binary number will become pretty huge.
Because of the limited memory resources within a CPU but a huge number of 0’s and 1’s, the computer is generally always in need of a space to store and recollect these bits.
Although within a computer, there is a memory called cache, it is pretty limited in terms of size. It is very expensive as well. Much nearer memory space for the CPU is called Registers but that is much smaller in terms of space.
So, we installed an easily scalable and affordable memory called Random Access Memory (RAM) for our computer. The cache memory acts as an intermediary between CPU and RAM. So, if the data is flowing out from the total register and then cache storage, it would go to the RAM automatically.
Then, if there is data that has to be stored permanently, we use computer storage i.e. hard drives, SSDs, etc.
How does Computer memory work?
Because the cache memory is always installed inside the CPU and we have no control over it, we are not going to talk about it here. Your computers also have ROM (Read Only Memory) but these are the topic for other discussions. Today, we will talk directly about the RAM.
Random Access Memory is a special type of temporary (volatile) memory that is designed to work faster but not for any permanent storage purpose.
It is based on capacitor storage which requires continuous charging to retain the stored information. The RAM Chips on your computer are the DRAM.
The charged state of a capacitor is considered high (1) and discharged (0). When we combine Thousands, Millions, and even billions of these microscopic capacitors, we can create a random access memory that is suitable to work alongside the cache memory.
Imagine your CPU has a big calculation in hand and there will be thousands of steps with millions of carries to re-collect and re-calculate. Perhaps the cache memory isn’t enough to store all the required data.
Now, the CPU will use the RAM for storing those bigger data sets and re-use them for the calculations. You may have realized the second reason why this would slow down the processing. Yes, the distance between the data and the CPU has increased.
How Does computer storage work?
The process of using the permanent storage devices by the CPU i.e. hard drives or solid-state drives is almost similar.
From the same example we took above, now the calculations are done and the CPU realizes that we have told it to create a text file with the result. For this, it has to be stored in a secure place. Then comes the permanent storage of the computer in the picture.
The data will now go through the cache and RAM and then be written to the storage.
If the primary storage drive is the hard drive, it would be sent to the HDD controller and it will write it bit by bit by switching the N and S sides on a magnetic platter. For the retrieval, the controller will check these states with the help of the read/write head and give the data back.
In the case of SSDs, again the SSD controller will take the inputs and program (write) the NAND Flash cells bit by bit and remember the location. For the retrieval, it would read the data from the location and send it back to the CPU.
Now, the path for data storage is increased more. Also, the permanent storage devices are much slower than the RAM. However, there is a big advantage of permanent data storage with a big storage volume.
Difference between Computer Memory and Storage
There are some key differences between computer memory and storage which we should definitely cover in our article.
Aspect | Computer Memory (RAM) | Storage (Hard Drive, SSD) |
---|---|---|
Definition | Temporary data storage used by the CPU | Permanent data storage for long-term use |
Type of Data | Volatile: Data is lost when power is turned off | Non-volatile: Data is retained even when power is off |
Access Speed | Very fast, measured in nanoseconds | Slower than RAM, measured in milliseconds |
Cost | More expensive per GB | Less expensive per GB |
Capacity | Typically smaller capacity (GB to a few TB) | Larger capacity (from GBs to multiple TBs) |
Function | Holds data and instructions that CPU actively uses | Stores operating system, applications, and user data |
Primary Components | Made up of integrated circuits (ICs) | Consists of spinning disks or solid-state memory chips |
Usage | Used for running programs, processes, and tasks | Used for storing files, documents, and applications |
Physical Location | Located on the motherboard | Usually housed externally or internally in a computer |
Persistence of Data | Data is lost when power is turned off | Data is retained even when power is turned off |
Performance Impact | Can significantly impact system performance | Typically has less impact on system performance |
Purpose of Computer Memory
As the scale of computers is increasing, the data they have to work with is becoming bigger and bigger. To have 2 to 3 tabs of Google Chrome (Text) opened at a time, you need around 300 MB of RAM. The more processing your system has to do, the more RAM it requires.
We can’t have that much cache inside of our CPU. It will make it too expensive and bulky.
So, we can call the computer memory a slower extension to the cache. It is a bigger pool with a compromise to the speed.
It is made not to retain the data permanently but to provide the CPU and fulfill the demand of all the software that has to run in order to get our computers working.
Purpose of Computer Storage
Once the problem of storing big chunks of temporary data is solved, we need a place to store the permanent data at a place where it is safe.
For that, we use computer storage. Again, the data is stored in the form of bits but the space has been increased. Now, we are talking in thousands of gigabytes. In 2024, the prominent permanent computer storage devices are Hard Drives and Solid State Drives.
The main purpose is to hold the OS and software data. These storage devices can release that data whenever required and load it onto the RAM. These drives also help in organization, backup, recovery, and sharing of data.
They are also useful for capacity expansion and storing big multimedia files.
Speed of Computer Memory
Generally, writing to and reading from computer memory (RAM) comprises 4 steps i.e.
- Memory Addressing
- Address Decoding
- Row Activation
- Column Access
- Data Transfer
- Write Confirmation (In case of Writing)
Now, if we look at the DDR4 RAM, it takes around 10 to 15 clock cycles to complete either of these operations.
To compare, the L1 cache generally requires 1 to 2 clock cycles for the same. The L2 cache generally takes 5 to 15 clock cycles.
As the DDR (Double Data Rate) is increasing, the speed is increasing. However, because of the fundamental design barriers, the RAM can never reach the speed of the cache.
Memory speed is typically denoted in megahertz (MHz) or gigahertz (GHz). For example, a memory module with a speed of 3200 MHz means that it can operate at a frequency of 3200 million clock cycles per second.
Speed of Computer Storage
The process of writing data on a computer storage device varies depending on the type of device. As we discussed above, HDD stores data mechanically on the magnetic platters. On the other hand, SSDs are based on transistor-based memory which is exceptionally faster than the HDDs.
Because of the mechanical parts included and the naturally slower process of writing, the maximum read/write speed of any hard drive is approximately 250 MB/s. This speed is directly proportional to the RPM at which the magnetic platter can rotate. Also, there is room for serious growth in terms of hard drive speed.
The SSD technology, on the other hand, is rapidly improving. The Gen 5.0 drives are here and SSDs like Gigabyte Aorus 10000 are reaching almost 10GB/s data read/write speed. Although the random and sequential read/write numbers are always going to be way apart that is a discussion for another time.
Speed Comparison Between Computer Memory and Storage
Let’s take an example of a 3200MHz DDR4 RAM. The data rate will be:
3200MHz * 2 = 6200MT/s
Now, the RAM has 64-bit bus width which means 8 bytes in total.
The data transfer rate of this RAM will be 6400MT/s * 8 bytes = 51200 MB/s.
These are approx numbers but if you compare this speed is pretty high as compared to the highest possible levels of SSDs i.e. ~10,000 MB/s till now.
Types of Computer Memory
1. Random Access Memory (RAM):
RAM is divided into several categories based on its usage and characteristics, including:
DRAM (Dynamic RAM): Common type of RAM used in most computers. Requires periodic refreshing to maintain data.
SRAM (Static RAM): Faster and more expensive than DRAM, used in cache memory and registers within the CPU.
DDR SDRAM (Double Data Rate Synchronous Dynamic RAM): An advanced type of DRAM that offers higher data transfer rates.
SDRAM (Synchronous Dynamic RAM): Synchronized with the CPU’s system clock, allowing for faster data access.
2. Read-Only Memory (ROM):
ROM is non-volatile memory used to store firmware and permanent system instructions that can’t be changed by the user.
Data like boot-up instructions, basic system functions, BIOS, etc are stored in this memory.
ROM is typically used to store critical system settings and firmware that control hardware components.
3. Cache Memory:
As we discussed earlier, cache memory is a small, high-speed memory located directly on or near the CPU.
It stores frequently accessed data and instructions to speed up CPU operations by reducing memory access latency.
Cache memory is divided into several levels (L1, L2, L3) based on proximity to the CPU and size.
4. Virtual Memory:
Virtual memory is a memory management technique used by operating systems to extend the available memory beyond physical RAM.
It utilizes a portion of the computer’s storage devices (e.g., hard drive, SSD) as temporary memory space to store data and swap it in and out of RAM as needed.
5. Registers:
Registers are the smallest and fastest type of memory used by the CPU to store data temporarily during processing.
They are built into the CPU and are used to hold data, instructions, and memory addresses during program execution.
Types of Computer Storage
Primary Storage:
Don’t get confused when I say RAM is the primary storage of your computer. This is just because it is the first storage that interacts with the CPU. It is temporary but nonetheless.
Secondary Storage:
Hard Disk Drives (HDDs):
Solid-State Drives (SSDs):
Hybrid Drives (SSHDs): Combination storage devices that integrate both HDD and SSD technologies. SSHDs use an SSD cache to store frequently accessed data, improving performance without sacrificing storage capacity.
External Storage Drives: Portable storage devices that connect to computers via USB, Thunderbolt, or other interfaces. These include external HDDs, SSDs, pen drives, and hybrid drives used for backup, file storage, and data transfer.
Network Attached Storage (NAS): These are specialized storage systems connected to a network, allowing multiple users to access and share files and data. NAS devices often contain multiple hard drives configured in RAID for data redundancy and enhanced performance.