- In the early days of the United States, when we would have trappers would who go out and they would catch beaver and all that different type of stuff, what they would do is they would take small supplies of stores, food, blankets, things like that, and they would bury them in little tucked away places just in case they were needed. And these were known as a cache. In the CPU world, cache works in a very, very similar way. It takes a little bit of what we need, and puts it in a place closer to us in case we need it.
But in order to understand cache, let's take a moment and appreciate the processing steps one more time. So, what I have in front of me here is a hard drive, some RAM, and a CPU. Programs, by default, live on your hard drive. When your computer's turned off, that's where the programs live. When you fire your computer up, your programs are still on here, unless you call to them. So, when you double click on Microsoft Word, or whatever it might be, what actually takes place is some of that program, not all of it, but some of it is copied over to RAM, and then the CPU is told where to start running the program itself.
So, in essence, what we have going, is kind of like this, I almost think of it as like a spreadsheet, and so the program gets loaded into RAM, and the CPU just starts going, tickety-tickety-tickety, down down down down down. Now this is good. We need RAM. If we tried to run the program from the hard drive, we could, it would work, but it would be way slow. Hard drives are thousands of times slower than RAM, so that's a bad idea. RAM is a lot faster than hard drives, but it's still quite a bit slower than the CPU itself.
So, in order to take advantage of the CPU's power, what we like to do is we like to put a little bit of RAM literally into the CPU itself. And we call this little bit of RAM a cache. So, here's my CPU. Now what we're gonna do is we're gonna put, I'm gonna use a cup because, I don't know. I like this cup. What we'll do is we'll put a little tiny bit of RAM physically in the CPU itself. Now, this is not regular RAM.
It's not like this kind of RAM. This is dynamic RAM. Dynamic RAM is fast and cheap, but there's another kind of RAM called static RAM, which is very, very expensive. Now you would never want to be able to put like eight gigabytes of static RAM into your computer. First, nobody sells it. And secondly, you might as well buy a new car. It's so expensive. But we can put a little bit into the CPU and we can speed things up. So what we can do, using this cup as an analogy, we could go ahead and start putting code.
When we go to the CPU, it grabs the code off the RAM and starts dumping it here into the cache itself. So what's gonna take place is that the programs come from RAM into the cache, and then the cache itself begins feeding the data into the CPU. The power of this is that if you're going down through RAM, running little programs, and all of a sudden you get to a line of code that says if last name equals Myers, then go way down here, all of a sudden the CPU is gonna go (whistles) waiting around until you can start grabbing the code in this new location.
So that's not a good thing. We want to avoid that. And what will take place is our cache, when he sees that code, cause he's literally got the code poured into him, now he can't do any processing. He's not a CPU. But he can actually see that if statement coming along and he can grab both directions of that if statement. And that way both pieces of code are already in here and the CPU can keep going. Now, the problem with the cache is that the more cache you have, the harder it is to find stuff in it.
So our first cache, this little cache right here, which is stored in the CPU, it's burned in the same silicon as the CPU, runs at the same speed as the CPU, which is good, but it's kept very, very small. Usually we're talking 128k. Somewhere around there. Now, that's great. But what would even be better is if we could have more cache. Now if you want to get an AMD and an Intel engineer into a fight, all you have to do is throw them into a padded room and just before you slam the door, go "The proper size of the cache is," and then shut the door cause they will be at it for days.
This is a big issue. Smaller caches are faster, but bigger caches can hold more information in case you get lots of branches and all this type of stuff. So basically what we've boiled down to is this idea. Instead of having big level one caches, we'll make another cache. Now he's only probably running about half the speed of the CPU. Now he's still physically on the same silicon as the CPU itself, but he's gonna be a lot bigger. In this case, I'll say he's around one megabyte.
There's variances here between different micro-architectures. So now what's gonna take place is instead of the RAM taking the programming and handing it to this cache, it's gonna hand it to this cache. Well now we have two caches. This first one, which is physically closest to the cores itself, is called the level one cache. The Level One cache is always going to be the fastest and the smallest cache. The next cache is going to be the level two cache. Level Two cache is going to be a lot bigger than the level one cache, and it usually runs at about half the speed.
Again, there is some variance in micro-architecture. Most of the time, the CPU is gonna be pulling from the level one cache. From time to time, the level one will pull from the level two, and sometimes the CPU will go straight to the level two cache. How all this takes place really varies by manufacturer and by architecture. So if you think two caches are good, wait till you see this. On most systems today, I think this would be illegal in New York City, but in most systems today, we actually have a level three cache.
So let me put this into the play. Now again, all of these caches are physically on the same silicon as your cores. The level three cache usually is running at motherboard speed or maybe a little bit faster than that. It's going to be big. Level three caches are the megabyte size. On this particular example, with my Core i7, it's 10 megabytes. So now what takes place is we literally, programs get poured into level three, which get poured into level two, which get poured into level one, which then, in turn, gets poured into the CPU itself.
The important issue for you and I is to appreciate, at least for the exam, make sure you know the level one is the smallest, and the fastest. Level two is about half the speed of the level one, and bigger. And then level three, if it's even on your CPU, is going to be much bigger and usually does run much faster than the motherboard itself. The nice part about caching is that it's completely automatic. You buy the CPU with the caching and it just works. There's nothing to tweak, or configure, or twist.
It's just a matter of you buying the CPU you like, and it happens to have the particular type of caching that comes with that CPU, and everybody's happy. (lively jazz music)
The CompTIA A+ 220-901 exam is comprised of six key parts. The first, core processing, is covered by this course. Instructor Mike Meyers explains the fundamentals of PCs, microprocessors, RAM, and BIOS. He also shows you how to set up, connect, maintain, and troubleshoot the main components of a computer.
Note: The six courses designed for the CompTIA A+ (220-901) exam preparation include core processing, core hardware, peripherals and building a PC, displays and printers, networking, and laptops and mobile devices.
We are now a CompTIA Content Publishing Partner. As such, we are able to offer CompTIA exam vouchers at a 10% discount. For more information on how to obtain this discount, please download these PDF instructions.
- How do personal computers (PCs) work?
- What is a central processing unit (CPU)?
- When is random access memory (RAM) used?
- What is a basic input/output system (BIOS)?
- Installing a CPU
- Working with extensions and sockets
- Troubleshooting RAM
- Setting up a BIOS