Photo by Jeremy Bezanger on Unsplash
How Much Can Your Computer Remember ? A beginner-friendly dig into the computer memory
This article will:
Deal with Computer memory and what it entails.
Help you to demystify some of the misconceptions plaguing the computer world.
printf("Let's get into it!!")
One of the most bizarre moments that I've ever experienced was when I failed an exam in High-school solely because I pulled an all-nighter only to crash on the exam day. The world of AI was just opening up then and all these monster memories we have on our gadgets were just sailing into our world then.
Honestly, I wished I was a robot!! I wish I could grasp the contents of books by mere knowing their names, I so much envied how the computer remembers it all!!. Well, I got to know that the computer isn't some kinda monster as I'd perceived it then when I dived into the programming world.
The computer memory is classified into both primary and secondary memory. I'll be focusing on the primary memory here because that's what serves the programmer. Just as the human brain is divided into different parts, the computer's primary memory is also divided into two parts which are the RAM and ROM. Also, I'll be narrowing down extensively on the RAM.
As human beings; daily, we have schedules and routines to execute. These routines can repeat themselves but they're always racing against time. However, in the case of the computer's RAM, it's racing against you !!!! Me ?? Yes, you, it gets to sleep and prepare for another day of turn when you decide to shut it down.
Unfortunately, the dichotomy between the human and computer RAM is that the computer RAM gets wiped off anytime the system is shut down.
How information is stored in your computer memory
The computer executes instructions using binary digits(0's and 1's) . Each of these digits is known as a "bit". I know your ears have once kissed the word "bytes" once upon a time, however, a byte is an array of 8bits. Just picture it as if you have a tray with cookies in it.
Each byte is labeled with an address for storing data inside the computer memory. These data are stored in these memory and are assigned an address so that they can be easily accessed when the computer beckons on them .
Now, let's do some simple Math and unravel some myths behind your computer memory
Did you know ?
1kilobyte of data = 1024bytes.
You may ask why 1024 bytes. This number was chosen because it makes it easier for the computer to store information. It means an array of bytes from 0 to 1023.
Converting 1023 to binary gives 10bits of 1's which are pretty easier for the computer to work with.
The myth I promise to unravel goes thus: when you buy a memory card supposedly labeled as 64GB of worth. Often times, what this means is that 64 billion bytes of memory which is not equal to 64 giga-bytes of memory. How?
#include<stdio.h>
#include <cmath.h>
#define BYTES 1024
int main(void)
{
float one_gb = pow(BYTES,3) ; //value of 1gb of memory
float sixty_four_billion_bytes = 64 * pow(10,9); // conversion of 64billion bytes to gigabytes
float conv_to_gb = sixty_four_billion_bytes / one_gb;
printf("The conversion gives %lf, conv_to_gb)
//Answer = 59.6GB
}
Hence, the manufacturer's specification of memory looks more elegant than it really is.
Next time, when you feel like your computer knows too much, try to remember that with the tap of the power button a genius can be laid to eternal rest. !!!