Before we understand how computers store data, it is important to know why computers need to store data. As you know computers have a hardware part and a software part. Different components in the hardware, for example, are CPU, RAM, and SSD.
CPU does the calculations. It takes commands from the users in the form of code and runs them by converting them to 0’s and 1’s. Everything including the data and instructions is required to be in 0s and 1s.
So, even smaller numbers and alphabets become pretty huge when we convert them into 0s and 1s. Now, in order to process them step by step, we need a space to hold the data that isn’t immediately required.
You can call Windows or macOS big programs that run on the hardware. Games like Red Dead Redemption and GTA-V are also programs that need to be stored somewhere.
These programs tell the CPU to do things in order to get some results i.e. change frames on the display in case of games. This can also include opening a browser, playing music videos, loading software, etc.
But, because there are several processes required to do these things, these codes become pretty big. So, for storing that data, we need computer storage.
Process of data storage in computers
As we all know, computers are electronic devices and the basic operation is the electric switching between high and low. We manipulate these current levels at our convenience to get the desired results. To tell a computer that we want to add numbers 1 and 2, we need to somehow pick a circuit and convert 1 and 2 into their respective symbol voltage levels. High/Low voltage levels are denoted by 0/1. We call these binary numbers.
1 in binary is 0001 which means 3 lows and 1 high.
2 in binary is 0010 which means 2 lows, one high, and then one low.
When we add these, we get 3 which is 0011.
Now, if we have to store 3 somewhere, we need some space where we can again assign its binary number in the form of voltage values.
Now, comes the temporary memory. Here, we can store these values as long as the power is provided. Temporary memory locations in a computer are registers, cache, and Random Access memory.
Now, if we have to store a result permanently, we use devices whose voltage levels can be retained even after the input power is switched off. For that, we either use magnetic platter devices such as hard drives or flash-based storage such as SSDs.
Computer Memory vs Storage
These names may sound similar but they are different in the context of computers. Memory refers to temporary storage and the term storage means permanent storage.
In simple words, computer memory is its RAM, Cache, and Registers while permanent storage is SSDs and HDDs. There are external devices as well but we are not talking about them here.
The memory will have a higher speed because it serves as a part of the CPU’s calculations. The CPU stores and retrieves the data from the memory which is frequently utilized for any calculations. The access time is going to be way lower than the secondary storage devices. Once the registers are filled, the CPU uses Cache memory. After the cache, RAM is there to serve its purpose.
But, when the RAM is also full and the calculations are still going on, the computer will become slow and it may freeze as well. This is because the CPU can’t use the secondary storage devices for its calculations in real-time.
Permanent storage is always a storage space to store big chunks of data like multimedia files, operating systems, and software data. This data is then loaded to the RAM as per the requirements. Once its purpose is completed, it can be written back to the storage device or cleared from the RAM.
Data storage hierarchy in computers
In order to do its job, the CPU requires memory. Once, it is done with the calculations, it needs some space to store the results so that it can be free for the upcoming tasks.
The first storage space for the CPU is Registers. They are used to store the results immediately before they go anywhere else.
Then, the CPU has cache memory, generally L1 and L2 cache. Cache has a higher storage space but less speed than the registers.
After the cache, we get our RAM (Random Access Memory). RAM has a higher storage space but less speed than the cache.
After the RAM, we get our secondary storage (SSD/HDD). Secondary storage has a higher storage space but less speed than RAM.
Permanent Storage in computers
I had planned this article just for the permanent storage process but giving you an idea about the memory was important.
Now, let’s get to the point.
The process of data storage majorly depends on the type of data storage device we are using.
Hard Drives
Hard Drives have become older storage devices but the technology that powers them is really fascinating. On the magnetic disk inside the hard drive, the bits are stored in the form of a magnetic field. On the disk, there is a layer of cobalt chromium tantalum alloy which is further divided into separate regions. The size of each divided sector is in nanometers.
With the help of a spindle, we use electric current to magnetize these regions. When magnetized, all the atoms can have their magnetic north/south poles pointing in one direction.
The direction of one sector doesn’t indicate the stored bit. But, it is the field emitted by two opposite regions because it is much stronger
There is a separate controller on the hard drive along with the DRAM buffer to work along with the CPU and remember the locations.
Solid State Drives
Inside the Solid State Drives, you’ll find millions and billions of floating gate transistors or charge trap flash cells. These transistors can hold the electric charge in their gate area. We use these charged and discharged states to store data bit by bit.
The electric field is passed through these gates during the writing process. This allows the transistors to hold the data. The region where the data is stored is insulated by the dielectric material that allows the charge trapped even when there is no power.
During the reading process, the location of this data is determined and the charge is checked.
SSDs are of different types. SLC SSDs use one of these transistors as one cell to store one bit of information hence called Single Level Cell.
MLC SSDs utilize a single cell on different levels of voltages to store 2 bits hence called multi-level cells.
TLC SSDs utilize a single cell with more voltage levels to store 3 bits hence called a triple-level cell.
QLC SSDs do the same and use a single cell to store 4 bits hence called a quad level cell.
As the single cell is being utilized for more than one-bit storage, the reliability is lost but the storage capacity of the overall drive is increasing. However, as the number of cells used per bit is increasing, the price is increasing as well hence SLC being the most expensive drives out there.
Why do computers need to store data?
Well, computers are pretty fast in doing what they do. From calculating the mouse pointer on the display and sending the click information to the CPU to taking the input from the keys pressed on the keyboard, a lot is going on beneath the surface.
But, there is an issue. There isn’t a lot of space to store this data altogether. Yes, some of the storage space is available in the registers and cache memory inside the CPU but that’s not enough when we talk about the gigabytes of data from our OS, software, and games.
So, in order to provide the CPU with extra space to store and recollect the required data, we provide it with the storage space. Now, it can use that space for long-term storage or short-term storage as required.
The capacitor-based memory called RAM has a quicker response time and higher read/write speed. The reason is that it picks random data locations by charging the capacitors.
If we talk about long-term storage, we have to store that in order to make our computers function for real-world usage. Without permanent storage, we can’t store the OS files anywhere. So, the computer won’t do anything after the system boots up. Also, the software and games are installed in the permanent storage.
How do computers store data?
According to the program in hand, the CPU stores the data in RAM or the storage drive. If it has to be used frequently, it will stay in the RAM. Otherwise, it will go to the long-term storage.
If I am editing a text file on a notepad app, the important files of both the video data and the software will be stored in the RAM if the system has enough of it. If the RAM is low, the data may be fetched from the secondary storage (SSD or HDD) and then pushed into the RAM. If I have to save the file, the CPU will send everything to the secondary storage but keep the files in the RAM until the software is closed.
In terms of operating system. The BIOS loads up the required file to first initiate the hardware and then do things like loading up settings, displaying the welcome menu, etc.
After the BIOS, the OS is the first layer of software on our computer. It provides us with a platform to do things like running programs and games.
Now, take the example of running video editing software on our Windows computers.
When we download Premiere Pro on our computer, it gets stored in our SSD from the official website in the form of a setup file.
Then, when we start the installation, the operating system adds it to its environment so that it can also be able to use the resources required for the editing tasks.
Once the software is installed, we fire it up and the CPU is instructed to take the required file from the storage to the RAM, Cache, and registers as required. Once it’s fully loaded and we have given no command to it, it may seem that nothing is going on but there are a lot of things still going on. Maybe a loop is running to keep checking for any new software updates through the internet.
But, just imagine, we load up a video file. Now, a portion of the video file including metadata and thumbnail will be loaded to the RAM for quicker access. As you start to edit things up, the RAM will be utilized to store the immediate required data and then store it back on the drive. Various techniques like caching and dynamic loading are used to optimize RAM usage.
During the rendering process, the CPU processes the geometry of the scenes and applies the transformations like rotations, scaling, etc. Because the sequence you edited on the editor wasn’t the editing, the harder part starts when you click export.
During rendering, the CPU and GPU are not only doing all the pixel processing, rasterization, depth testing, etc, but it is also writing the data on your drive. That is why rendering takes time.
I hope this helps!