Skip to main content

Featured

Upcoming Plans & Goals for 2020.

Hello everyone, as you can pretty much guess what this blog is all about from the title. I know am running late and this article will be live on 1 Jan 2020. But, bare with me for a while. This is not a regular article. This is more about the future of this website/blog. And you guys are the most important part of it. Let's jump right into it.
So, when I started this blog in 2017, it was mainly a hobby. I was just finished up with high school and needed something to do. During these two and a half years, a lot of things happened. I finished college, improved a lot personally as well as my professional/primary skillsets (i.e coding). And among all these things, there were always assignments, tests, some personal issues, sickness, exploring. And, the blog always suffered due to that. Honestly, I don't have major regrets for that because I learned a lot of languages, designing, a little bit of marketing, SEO. I also got to learn a ton about me and things that matter to me. And, I…

Geeky Shots: What is Cache?


Hello everyone, hope you all doing great. Today, I am going to discuss one of the most confusing things, Cache, I would try my best to stick to the topic without any distraction. My objective is that by the end of the article, you will have a strong understanding of cache. I won't be going too deep because it is easy to get confused about it. Having said that, I won't be going for information any less than required.

What is Cache?

Cache memory is the fastest storage on the CPU, which stores the most frequently used data and instructions from RAM. This reduces the processing time and delivers you faster performance. As soon as you are given a task to your  CPU, it goes to cache before primary memory. If data is found in the cache, then it's called a "cache hit". Otherwise, it's called a "cache miss", this also helps for cache management i.e. Whether to keep data in cache or not. Let me put it this way, you won't instantly remember if I ask you what you did at work 15 days ago at 5: 00 pm but you remember what you did this morning or things which you do every day. This is similar to what cache does. It stores the most frequent data or the location of that data in the memory to be exact.

Why We Need Cache Memory?

So, why do we need Cache? Aren't the storage drive (hard disk drive or solid state drive) or memory (RAM/ Dynamic Memory) fast enough? The answer to this question is a clear NO. Here's how the hierarchy works. Static Memory (cache memory) > Dynamic/Main Memory (RAM) > Storage  (HDD/SSD).


Now, how much of a difference do they have. Storage memory is way slower to even compare. And for RAM, even the fastest DDR4 memory works at 2133 MHz. And the CPU can be anywhere from 1.6 GHz to 3.7 GHz. And these processors are at least dual core if not quad-core or octa-core. And this is why RAM is not as fast as processors. Because there are multiple cores, who need to access memory at the same rate. If the CPU needs to wait for a long time, it makes your processing time long.

Now, you might be thinking that if cache memory is so fast, then why not all memory is cache memory. Well, I think most of you have already guessed it. Yes, It's super-expensive. Recently, we have seen a reduction in SSD pricing, that too after SSDs been around for years now. What I am trying to say is that we all are aware of the price difference between SSDs and HDDs. And the price difference for the cache is way higher than that.

Types Of Cache?


There are various kinds of cache memory, for hardware and software. It works the same way and for reasons as said above. In the hardware section, CPU, GPU both have some amount of cache memory. On the software side, there are disc cache, web cache and a lot more. No matter what, but their function is the same.

In addition to that, there are also different levels of cache. For example, there are three levels of CPU cache, namely L1, L2, and L3. L1 have less capacity but faster than L2 (more capacity), L1 operates at the same speed of CPU. On the other hand, L3 has more capacity than L2 and L1 but is slower than them. Also, L1 and L2 have their own cores. You might be asking yourself how do they store data?  L1 stores the most frequently used data. L2 stores the data missed by L1 and so on. 

Make sure to share your thoughts in the comment section below. And, for all the updates, you can follow me on InstagramFacebook, and Twitter.

Thank You & Stay Tuned

    




Comments

Popular Posts