What's up guys,
I hope you're all doing well.
Introduction
The basic intro for this article is that a computer system has a lot of different types of memory besides RAM. I'm going to try to introduce those other types of memory and give you a basic understanding of how they work and how they might be utilized in the computer system.
The basic foundation of computer memory is something called the “Memory Hierarchy”
This is a picture of the Memory Hierarchy. [Image source: -Wikipedia]
First check out the bottom of the Memory Hierarchy, these include memories that are really slow but really big. Examples include your Hard Drives, flash drives, they can hold terabytes of data and have your music, games, movies, etc.
Bottom of the hierarchy is for slow and big memories. At the very top of the memory Hierarchy, that's where the fastest and smallest memories exist. The fastest and smallest memory is a register and I'll go over that later.
“A brief recap”
The bottom of the Hierarchy is for slow and big memories, the top of the Hierarchy is for fast but really small memories. Just keep that in mind and everything will be a lot easier to understand. The slowest and biggest memories you already know, those are your Hard Drives and they keep all your data when there's no electricity in them. They also hold terabytes of data and you can carry them around.
The next level of memory above Hard Drives is “RAM”. You can never really have terabytes of RAM, just gigabytes of it. It's much smaller than your Hard Drive but it's much faster to access. Remember, any type of program run your computer has to exist in RAM first for the processor to execute it.
Let's go one level above RAM to a memory that's called “L2 cache”. L2 cache memory sounds really cool and it is really cool, so let’s check it out.
L2 cache
An L2 cache is smaller than RAM and it’s also much faster. While you have 8 or 16 gigabytes of RAM, your L2 cache is on the order of megabytes, maybe 256 megabytes. The concept of an L2 cache is more or less simple, important data that access it frequently is kept in the L2 cache, so the processor can get to it much faster without going back into RAM.
If your closet was RAM, then the L2 cache would be your bedroom floor where you keep your favorite boxers all the time that you wear every day. All the memory that I've explained up into this point is called “off-chip memory”
What’s off-chip memory?
If you ever open up your computer, you see a processor which is that cool little square thing that has cooling system on it to keep it cold, that’s the processor also known as the chip. Whenever someone says something is off-chip, it's not included on the little cool square processor.
[Image source: -Pixabay]
When you upgrade your computer and buy two new sticks of RAM and stick them on your motherboard, you don't stick them inside your processor. RAM and L2 cache is an off-chip memory. All the memory I've explained up into this point, Hard Drives, RAM, L2 cache are off the chip.
On-chip memory
The first memory that's on-chip is something called the L1 cache. L2 and L1 are just level 2 and level 1 cache. Usually, a level 2 cache is off-chip and the level 1 cache is on-chip, that's usually the only difference.
An L1 cache is smaller than L2 cache but it's also much faster than access. A general rule of thumb is that if anything is on-chip, it's very fast and if there's off-chip memory, the processor needs to go a special way to get to it and it could be slow. Above L1 caches is a memory called “Registers.”
What’s a Register?
A Register is the smallest and the fastest piece of memory inside a computer system and one cool thing to note here is that the number of registers is actually defined by the instruction set architecture. Different instruction set architectures kind of dictate how many registers there have to be, and then different implementations will accommodate for that.
L1 cache
After Registers, we have the L1 cache which is also an on-chip memory and it's really fast. L1 cache isn't as fast as registers, it's still almost instantaneous. Once we start going into off-chip memories, things start getting kind of slow.
First, let's put L2 cache into perspective.
Say you need a special Chinese spice, going back to the pantry to get that special Chinese spice is going to take you about ten seconds. That analogy is about equivalent to an L2 cache access. Most L2 accesses are about 10 cycles which is ten times slower than L1 or register access.
[Image source: -Flickr]
We're moving down the hierarchy and after L2 cache memory, is RAM. To use a spicy sauce, you need to get a live duck and you need to get out of the Kitchen, kill your duck and bring it back. It's going to take you like two minutes or so. RAM is about a hundred times slower than a register access.
In Conclusion
Hopefully, you guys have a little bit of a better appreciation of how much faster some memories can be than others inside one computer system. Just remember the basics of the memory hierarchy: at the bottom, we have slow but very big memories and at the top we have small but very fast memories.
Every level of memory on the computer Hierarchy is a cache for the level below it. The term caching is very general, computers are super complicated things but they're really amazing. It still boggles my mind how they work, they just all work somehow. I hope you guys enjoyed the article and got a better appreciation of the different types of memory in a computer system.
The memory hierarchy is a really good foundation to know and hopefully, the knowledge is useful for you sometime. Don’t hesitate to smash that upvote button below.
Have a great week ahead.
References: 1 - 2 - 3 - 4
Image sources: 1 - 2 - 3
GIFs made by @rocking-dave and @foundation
hey @ememovic you give great indepth knowledge regarding technical computing appreciate your work.
This is a very informative post @ememovic. I haven't known until now the different types of memories a computer could has, I've always heard about the RAM. Using smartphones I try to erase the cache as often as possible to set free some storage space and so be able todownload some apps. What's the cache function in a digital device as smartphones with android systems? Best regards from @presentnworldsc
Really nice work there buddy,am a computer sc. student and u xplained dis in amuch simpler way.Kudos
Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 16 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.
I upvoted your contribution because to my mind your post is at least 23 SBD worth and should receive 42 votes. It's now up to the lovely Steemit community to make this come true.
I am
TrufflePig
, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!Have a nice day and sincerely yours,
TrufflePig
Hi, take a look at my best of tech blog and consider following if you find it interesting.