Here’s a comprehensive explanation of how does computer memory work (RAM, hard disk, cache, and other memory units working ) in the most simpler form.
As we all know memory units like RAM, cache, Hard disk, pen drives, and many other devices are used in computers. But, did you ever wonder what RAM does? How does it make our PC faster? What is Cache? If RAM and cache is a memory that stores data (similar to hard disk ), then why don’t we use them as a storage device?
Learn everything about working and types of Memory in a computer memory system.
Memory plays a vital part in our life, it describes who we are. We learn and record skills, data, and information from our past. Similarly, a computer consists of memory where the past data is stored, which can be further accessed or modified. It could be a file, image, movie, or any instructions.
Everything in computer memory is in the form of a small unit called bits also known as binary Digits. Each of these is stored in a memory shell (which can either be 0 or 1). Files and other data in memory consist of millions of bits which are all processed by CPU (the brain of a computer).
As the number of bits increases exponentially, the processing power reduces and it becomes harder and harder for the processor to process the data. Hence, computer designers face a constant struggle between size, speed and most importantly managing the cost. These are the important factor that leads to a better memory system.
Now, let’s see how computer memory works, what is memory system and understand the different categories of memory.
Categories of Computer memory
- Short Term Memory (RAM, Cache)
- Long Term Memory (Hard-disk, Optical Drive, SSD, Pen-drives…)
Like us, Computers also has short term and long term memory. Short term memory is used for immediate/ instant tasks and long term memory units are used for permanent or temporary storage. Whenever you execute a program or perform an instant input, the operating system will allocate the instructions into short term memory.
For Ex: If you click on “A” in the keyboard, this memory unit sends some bits of data to the CPU to perform the specific task.
Short Term Memory – DRAM and SRAM
The time CPU takes to process bits of data is called as memory latency. Any process in short term memory can be accessed in any order, hence the name Random Access Memory (RAM) was bought into the picture.
Now, let us talk about how RAM works and the types of RAM – DRAM, SRAM. The most common type of ram used is Dynamic RAM. In this type of RAM, each memory cell consists of a transistor and a capacitor that stores electrical charges ( 0 if there is no charge and 1 if charged). Such memory is called as dynamic because it holds charges periodically as the charges leak away and need further charging to retain data.
There is also another type of memory called Firmware, commonly known as ROM. You can check out how it works, types, and other details from here.
What is Cache Memory and why we need it?
Although the RAM has low latency (about 100 nanoseconds), still it is very slow for a processor to process data. Hence, a new type of high-speed internal memory is introduced known as cache memory. This memory is inbuilt in the processor and acts as a mediator between RAM and CPU to transfer data at high speed.
Cache memory is actually a Static RAM (SRAM) which consists of six interlocked transistors. This type of memory has a very high speed and also occupies more space.
Difference between RAM and Cache Memory
|Stores less redundant data hence needs refreshing.||Stores frequent data, hence no refreshing.|
|Cheaper compared to Cache memory.||Highly expensive compared to RAM.|
|Takes less Space Comparatively.||Takes 3 times more space than RAM.|
|Read and write transfer rates are slow.||Read-write transfer are faster than RAM|
|CPU reads the data from RAM once cache memory is checked.||CPU reads the cache memory first and then goes to RAM.|
We have so many reasons to use RAM as a storage device in our PC, then why we don’t use it? It’s because RAM and cache have a major common problem i.e once the power is turned off, the data gets destroyed, which means the data bits present in RAM or Cache can be stored only when power is ON. This is the reason we use Long-term Memory.
What is Long-term Memory?
These are basically the devices that are used to store the data like images, videos, text files, and more… permanently even when power is OFF. Some examples of Long term memories are Magnetic drive ( commonly known as hard disks ), Optical Drives ( CD, Blu-ray ), and other external storage devices like pen drives, sd card, etc…
Long term memory devices store the data that can be further processed by RAM and cache memory. For data to remain permanently even when the power is off, we use these types of memory. There are 3 major types in Long term memory
Types of Long term memory devices
- Magnetic Disk Storage’s (Hard Disk- HDD)
This is the cheapest long term memory disk in the market right now. Here the data is stored in a disk coated with magnetic films, using magnetic patterns. The advantage of these disks is it can store huge amount of data compared to any other memory system, but the latency is very low (almost 100k times slower than DRAM), because to find the certain data, the disk has to rotate and check the patterns.
Did you know: The first 1GB hard disk was priced at $40000.
Read more amazing facts about the computer you probably didn’t know about.
- Optical disks (CD, Blu-ray)
There are Compact Disks and Blu-rays that use the same method of storing data like hard disks but in the place of magnetic coating and patterns, the reflective coating is used with light and dark spots encoded in the disk using a die which can be read with help of laser. Optical disks have even slower latency than magnetic disks storage and also cheaper comparatively.
- Solid State devices (SSD, Pen drives)
Finally, there are the latest and fastest long term storage devices called Solid-state drives like flask disk (pen drive), SSD (m.2, NVMe). These are solid and non-mechanical storage device, so it is faster and more durable. This type of device consists of gate transistors where bits are stored by trapping or allowing charges within there designed internal structure.
NOTE: There are also other memory systems like virtual memory which I will be explaining later on, in detail. Subscribe to our newsletter to get updates on our latest posts.
So, Now as we know all about what is Memory, how it works, and types. The question arises that how reliable is this memory system or generally these innumerable bits of memory in the future?
Most of us think that the bits can be permanently stored, but the reality is, as time passes, the data slowly degrades and there is a loss of bits from all these memory devices. Even SSD, HDD cannot store the data permanently for a decade or two. This is caused because of many reasons such as heating issues, leakage, and corrosion.
The heat generated from the computer components or the electrical devices can lead to the loss of bits from memory devices like harddisk (The magnetic disks gets demagnetized.), die in the optical disks get degraded, and also charge leakage in floating gates in SSD can cause loss of memory bits. One more problem with these solid-state devices is that it gets corroded when the charges are transferred repeatedly and it goes dead eventually.
Currently, the average storage devices can store data about 8-10 years on average. There are various research conducted at the quantum level to improve the storage devices, but for now truly permanent memory devices doesn’t exist.
You might also like reading these posts:
How do Quantum Computers work?
Is 5G dangerous? Difference between 4G and 5G network