Why do CPUs Need Caches? - Computerphile

Sdílet
Vložit
  • čas přidán 8. 06. 2024
  • We've all heard of web browser caches, but why does a super fast modern CPU need a cache? Because it's too fast. Dr Steve "Heartbleed" Bagley explains.
    Professor Steve Furber on Building the BBC Micro: • Building the BBC Micro...
    How Computer Memory Works: • How Computer Memory Wo...
    Why Asimov's Laws Don't Work: • Why Asimov's Laws of R...
    The Problem with JPEG: • The Problem with JPEG ...
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscomputer
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Komentáře • 332

  • @UltimatePerfection
    @UltimatePerfection Před 8 lety +691

    Why RAM access is so slow? Because it has to take a bus.

    • @TheBluMeeny
      @TheBluMeeny Před 8 lety +18

      +QVear I love this joke.

    • @UltimatePerfection
      @UltimatePerfection Před 8 lety +3

      +Zark Bit That's because I've made that up.

    • @CatnamedMittens
      @CatnamedMittens Před 8 lety +1

      +QVear I don't get it.

    • @NeXtdra42
      @NeXtdra42 Před 8 lety +19

      +QVear at least now its all interconnected on a quick path instead of having to go over the bridge in the north.. such a nice shortcut

    • @zeuglcockatrice4633
      @zeuglcockatrice4633 Před 8 lety +3

      +CatnamedMittens Michael Bialas The memory bus is what connects the ram to the cpu,also the bus in general is what connects the different parts in your computer,it's those lines on the motherboard

  • @Tata-Jooma
    @Tata-Jooma Před 8 lety +65

    4:58 "You only need a relatively small amount of cash to make a significant difference". #gangsta #hollahollagetdolla

  • @simon24h
    @simon24h Před 8 lety +26

    Modern CPUs often have three caches, the one that is described by this video (separate for data and instructions) is the L1 cache, the fastest, and every core has it's own. L2 is larger often shared between cores (2 on my system) . L3 is the biggest and there is only one for the actual chip on which the cores are.

    • @CeezGeez
      @CeezGeez Před rokem

      ty

    • @samhadi7972
      @samhadi7972 Před 9 měsíci +2

      And we must structure our data access in such a way to use the caches as much as possible and delay the need to eventually go out to main memory, That’s the “fun” part

  • @robharwood3538
    @robharwood3538 Před 8 lety +20

    Good use of animations to help visualize the explanations. Kudos to the animator(s).

  • @Neeboopsh
    @Neeboopsh Před 8 lety +53

    That cpu at 3:09 is rocking a bernie sanders look.

    • @Gennys
      @Gennys Před 8 lety +1

      +Neeboopsh I would have gone with Einstein personally.

    • @Cygnus0lor
      @Cygnus0lor Před 5 lety

      Laughed so hard at that...

    • @Tylerc442
      @Tylerc442 Před 5 lety

      LOL. I love you.

  • @jamesgoodman5102
    @jamesgoodman5102 Před 8 lety +136

    cache rules everything around me

  • @jaffarbh
    @jaffarbh Před 2 lety +7

    Just a bit of clarification, nowadays RAM chips can be clocked faster than the CPU, but the latency remains quite high (relatively), so cach memory is here to stay indeed.

  • @TheEulerID
    @TheEulerID Před 4 měsíci +1

    The cache is the kitchen cupboard, main memory is the corner shop and disk storage is buying on-line at a supermarket. It's a lot quicker to get the cornflakes out of the cupboard than walk to the corner shop for the same item, let along wait a couple of days for them to be delivered.

  • @user-id1gr8ts4p
    @user-id1gr8ts4p Před 3 lety

    2:42 all my years-long confusion about cache wiped out with the 20 second animation. It's fantastic Computerphile!

  • @Screpheep
    @Screpheep Před 8 lety +109

    Vote for turnip!

    • @OwenPrescott
      @OwenPrescott Před 8 lety +5

      +Screpheep I read this as "Vote for trump", ironically they're both strangely similar.

    • @Rock48100
      @Rock48100 Před 8 lety +2

      +Owen Prescott That's not ironic, that's coincidental.
      > *_Coincidentally_* they're both strangely similar.

    • @ninjaed13
      @ninjaed13 Před 8 lety +4

      +Rock It could be considered ironic, if you believe that Trump has the mental capacity and grasp of world politics of a turnip.

    • @filmfritzcth
      @filmfritzcth Před 8 lety

      +Debated Nothing And it's really great turnip by the way, it's some tremendous turnip.

    • @josgeerink9434
      @josgeerink9434 Před 6 lety

      I wanted to comment that!

  • @pacrat90
    @pacrat90 Před 8 lety +1

    Always so excited to open my browser on a new computerphile video! Thanks for the quality videos.

  • @rchandraonline
    @rchandraonline Před 8 lety +4

    cache hits and misses, cache consistency, cache locality, write-through vs. writeback, cache segmentation (as mentioned, instruction and data), multiple cache levels...cache is a moderatly complex and very much researched topic. This however is a great introduction to the basics.

  • @ExaltedDuck
    @ExaltedDuck Před 8 lety +37

    Why do computers need caches? To buy their grocheries.

    • @stensoft
      @stensoft Před 8 lety +17

      +ExaltedDuck They store their groceries there for late night stews

  • @davidratkay9281
    @davidratkay9281 Před 7 lety

    Glad there is a computer channel like this.

  • @Aemilindore
    @Aemilindore Před 8 lety +1

    Thank you! cleared a lot of doubts.

  • @nO_d3N1AL
    @nO_d3N1AL Před 8 lety +1

    Great explanation and analogy!

  • @VickyBro
    @VickyBro Před 8 lety +4

    Wow. What a clear and succinct information.

  • @epowouid6715
    @epowouid6715 Před 8 lety +4

    Great explanation!

  • @vladislavkaras491
    @vladislavkaras491 Před 2 lety +3

    Really great explanation. Simple and informative!
    Though, it is kinda sad, that it is impossible to disable cache, just to feel, how important it is.

  • @SCB666
    @SCB666 Před 8 lety

    Best explanation about what cache is I've ever listened to.

  • @thomasalexander1563
    @thomasalexander1563 Před 7 lety

    Awesome Channel..
    Can't find tutorial about cache like this..
    Thank you..

  • @DavidTurnell
    @DavidTurnell Před 8 lety +2

    Thank you so much for not saying uuum, uuum, uuum every sentence. Remember you are the result of tens of thousands of years of recent human evolution. Be proud of this.

  • @JoshuaBarretto
    @JoshuaBarretto Před 8 lety +115

    Can I just say now how much I appreciate you putting the DuckDuckGo logo into this video... Well done. Best search engine there is by miles.

    • @TheAlison1456
      @TheAlison1456 Před 8 lety +1

      +Barry Smith Why? The name sounds kinda... You know, virus-y, that's why i unninstalled it at first glance.

    • @HIRVIism
      @HIRVIism Před 8 lety +6

      +Unknow0059 # They don't sell their users' information, I think. That's one of the big things.

    • @iamjimgroth
      @iamjimgroth Před 8 lety +59

      +Unknow0059 # uninstalled? It's a search engine.

    • @XTpF4vaQEp
      @XTpF4vaQEp Před 8 lety +20

      +Barry Smith I dig their privacy policy. But honestly, at least in my experience Google still provides the best search results by miles. And personally, I don't care about Google making money on me, hey, it's a business after all, nothing more.

    • @TheAlison1456
      @TheAlison1456 Před 8 lety +1

      Jim Groth
      Yes.

  • @ericsbuds
    @ericsbuds Před 8 lety +8

    I like Dr Bagley's explanations. He is great. Thanks for the interesting vid! love learning the innerworkings of computers!

  • @Lexyvil
    @Lexyvil Před 8 lety

    One of the best channels on CZcams.

  • @Majornerdacc
    @Majornerdacc Před 8 lety +14

    This is the best channel in the world.

    • @Majornerdacc
      @Majornerdacc Před 8 lety +2

      +Alex Azazel Agreed.

    • @TheBluMeeny
      @TheBluMeeny Před 8 lety +1

      +Alex Azazel BETTER than numberphile ;)

    • @U014B
      @U014B Před 8 lety

      I agree with your sentiment, but I have to say the best channel on CZcams is definitely Lasagna Cat.

  • @Thekim1722
    @Thekim1722 Před 8 lety

    A very good way to explain what cache is, becouse I didnt now what it was before I watched this

  • @ozzell
    @ozzell Před 8 lety +8

    What a coincidence. I just had a lecture on computer memory today.

    • @sundhaug92
      @sundhaug92 Před 8 lety +10

      +SternMann93 Do you still have it in cache or commited to memory?

  • @dilbyjones
    @dilbyjones Před rokem

    Thanks Fellas it took me so so long to find this chan.

  • @DJSkunkieButt
    @DJSkunkieButt Před 8 lety +1

    You should do a follow up video for multiprocessor cache coherency c:

  • @TheHoaxHotel
    @TheHoaxHotel Před 8 lety +14

    Mmm, time for some turnip stew.

    • @dylf14
      @dylf14 Před 8 lety

      +The Hoax Hotel Hey, didn't expect you here.

  • @whuzzzup
    @whuzzzup Před 8 lety

    You could have elaborated on what's going on with L1-L3 Caches. Is one for data the other for instructions, or do they have no preferences? If they can/will store the same, how does the CPU decide what to put where as they have different speeds?
    I think this should be even in a beginner video, because you will be confronted with those values in most ads.

  • @MrSparker95
    @MrSparker95 Před 8 lety

    I think it would be great if you made a video about FPGAs, I wonder what you think about programmable logic.

  • @danielgrace7887
    @danielgrace7887 Před 8 lety

    I am confused. Please describe this as an optimisation problem: what are your decision variables, what is the objective function and what algorithm are you going to use to solve it all?

  • @AmeerFazal
    @AmeerFazal Před 8 lety

    Thanks! :)

  • @heesooyang6586
    @heesooyang6586 Před 8 lety +1

    Can we have a video about single and double precision computing?

  • @hikari_no_yume
    @hikari_no_yume Před 8 lety

    You then have different levels of cache. Each level is slower, but it has more space.
    Modern desktop CPUs have three levels of cache before going to RAM. Some server CPUs have a level 4 cache.

  • @Landrew0
    @Landrew0 Před 8 lety

    Does memory cache function in a computer, similar to the way a capacitor functions in an electronic circuit?

  • @panchtatvam
    @panchtatvam Před 8 lety +37

    +ComputerPhile आपकी एनिमेशन बहुत अच्छी होती हैं । आप किस तंत्रांश कि सहायता से इन्हें बनाते हैं ?
    --------------------
    +ComputerPhile Your animation is pretty good. What software do you use to make it ?

    • @Computerphile
      @Computerphile  Před 8 lety +23

      +आकाश कुमार शर्मा (पंचतत्वम्) Many thanks - Animations done with Adobe After Effects >Sean

    • @panchtatvam
      @panchtatvam Před 8 lety

      *****
      धन्यवाद ।
      -------------------
      ***** Thanks.

    • @ayushdhar
      @ayushdhar Před 8 lety +2

      +आकाश कुमार शर्मा (पंचतत्वम्) What is with the dual languages?

    • @andrewtaylor9433
      @andrewtaylor9433 Před 8 lety +3

      +Ayush Dhar Not all people use english keyboards?

    • @andrewtaylor9433
      @andrewtaylor9433 Před 8 lety +2

      +Ayush Dhar Not all people use english keyboards?

  • @knaik
    @knaik Před 8 lety +3

    Is there any major difference between the different types of Caches? I have heard of terms L1, L2, and L3, but I'm not sure what the differences between them are significant.

    • @mattsains
      @mattsains Před 8 lety +8

      +Karan Naik They're different speed caches. L1 is the fastest, but the most expensive to make, so you tend to have less of it, while L3 is cheaper but slower (but obviously still faster than RAM)

    • @radioactiveduckie111
      @radioactiveduckie111 Před 8 lety +3

      +Karan Naik in a class at the university we compared the speeds and costs of the different storage options (hdd, RAM, L3,L2,L1 etc.) and the differences were just huge. Going from one level to another often meant a speed (and cost) increase of a factor of a hundred or even a thousand. Another very important metric on the low level stuff is the access time; on the L1/L2/L3 Cache on the CPU it is dramatically shorter than on the RAM or your harddisk

    • @mattsains
      @mattsains Před 8 lety +4

      szErnzEit
      Yep, on a haswell CPU, in the time it takes the CPU to fetch from L1, light travels 39cm

    • @sundhaug92
      @sundhaug92 Před 8 lety +1

      +Karan Naik In general, L2 is slower than L1 but has more capacity, L3 is slower and has more capacity than L2. This means that using L1 cache is prefered but a when a page in L1 is invalidated, it's invalidated to L2, L2 to L3, L3 to RAM

  • @riyadhmenacer9651
    @riyadhmenacer9651 Před 6 lety +1

    He explains stuff in these videos better than he does in my lectures with him! fml ahaha

  • @JoshuaCooperDerpyMcDerpy

    So just a bit of curiosity mixed with some at the moment "current events," with the advent of faster DDR4 memory being capable of speeds of around 3000 MHz (3 GHz) and processor speeds largely staying the same over the last approximate 7-10 years is it possible that cache may become less important of a component, or is it that when you combine the both multi-threaded applications both in multi-core and hyper-threaded applications that the explanation for cache becomes more complex than simply the clock speed of a processor and the speed of the RAM being a major difference between each other as it was in the past?

    • @lotrbuilders5041
      @lotrbuilders5041 Před 7 lety

      Joshua Cooper well it would need to do one get data and send it back cycle per instruction. The instructions per clock cycle are nowadays often higher then 1 and all cores would need to do that in serie because ram is mostly not parallel. We would probably need 12 ghz ram before we don't need cache, but then CPU will have a similar speed

  • @maka2211
    @maka2211 Před 8 lety +1

    His shirts are mesmerizing. Where does he get them from?

  • @matsv201
    @matsv201 Před 8 lety

    The is actually a additional problem apart from cost. Silicon chips can only be made in a certain size, about 300-400mm^2 is tops. A normal computer needs a typically say 4-16GB of ram today, and it would consume over 1000mm^2 of space. This make it so you have to make a multi chip solution.
    Then of chip memory have to use board wires, they are a lot slower than silicone wires, make it so you need more cache.
    Actually, the premise that its that DRAM is the reason why cache is needed. But the wires is the issue that make it so we need a lot of cache

  • @yakud3091
    @yakud3091 Před 6 lety +1

    2:24 That sounds quite ambiguous in 2018...

  • @kyle8952
    @kyle8952 Před 8 lety

    Bagley how'd you get an Archimedes with two floppy drives?

  • @cherizar100
    @cherizar100 Před 8 lety

    I would love if you did a video on if computers are inevitable, let's say all computing technology and everything that stemmed from them was erased, would humans Develop a computer again. What's happened in history for people to first have the idea of a computer and farther and farther back, like what lead to what lead to what, all collaborating technologies , infrastructure, and sciences that spawned the computer. I know it may take a really long episode or a few episodes but it would be really cool. What was square one? What was just before that, that lead to square one. Hope this makes sense.

  • @vortyx090
    @vortyx090 Před 8 lety

    Cool, ty :D

  • @DustinRodriguez1_0
    @DustinRodriguez1_0 Před 8 lety +4

    I can't wait until memristor technology matures and we don't have to worry about multi-level caching and all of this complication. Having just one big matrix of memristors will enable us to have a flat memory space, all nonvolatile, and eventually the memristors will be able to be dynamically changed from providing data storage to actually performing computation, so even the CPU will just be part of the memristor matrix.

  • @theyellowmeteor
    @theyellowmeteor Před 7 lety

    Where can I find more videos about the Turnip Machine?

  • @zombieregime
    @zombieregime Před 8 lety

    the point of modern CPU speeds vs RAM speeds forcing the use of more space on the silicon begs the question... what would a 3Ghz, ram stick look like? how much space could a normal sized(lets say DDR2) stick hold? how big would a 8GB stick need to be?

  • @ElagabalusRex
    @ElagabalusRex Před 8 lety +3

    Can compilers explicitly reference the cache in the same way as RAM or registers?

    • @stensoft
      @stensoft Před 8 lety +4

      +ElagabalusRex No, the cache is transparent. You can flush or disable the cache but not control its content.

    • @PeterWalkerHP16c
      @PeterWalkerHP16c Před 8 lety

      +ElagabalusRex As Jan said No. However you can try and optimise compilers so they don't break the cache and stall the pipeline. That's a whole other discussion.

    • @sundhaug92
      @sundhaug92 Před 8 lety

      +ElagabalusRex Generally no, most cache is transparent, but for example the PS3 has cache that can be directly refered to.

  • @MasterC2012
    @MasterC2012 Před 8 lety +1

    Just want to point out that the word cache is from the french verb cacher (to hide).

  • @MatthewGoreBGenomics
    @MatthewGoreBGenomics Před 8 lety

    I think you started to explain at the end... what is the L1 and L2 cache? I remember theis was a structure the put on in the late 90s. This is the CPU cache you speak of, and the RAM cache is the instruction memory? Chrome cache just made me type this twice when the vid changed, and is this a failure of the route-a-begga?

    • @sundhaug92
      @sundhaug92 Před 8 lety +1

      +Matthew Gore L1 and L2 are cache levels, L1 being closest to the core and is faster but has less storage than L2. For each layer, there's both instruction and data cache. If you have a CPU with say 3 levels of cache (quite usual) then you can think of RAM as cache level 4 and your harddisk (through the page file) as cache level 5 (though if you have an SSHD, that being a hybrid SSD/HDD, that's level 5 for the SSD and 6 for the HDD). Double-posting isn't necessarily an issue with routing or caches but just one of the hickups that sometimes happens.

    • @MatthewGoreBGenomics
      @MatthewGoreBGenomics Před 8 lety

      sundhaug92 wow, thanks for the reply - quite descriptive, and very appreciated. IMO, hardware architecture is SYSK, I mean we use it every day, and should know the tech diffs between steady state and optical

  • @njack1994
    @njack1994 Před 7 lety

    I understand why we need cache but why do we need a centralized cache? Wouldn't if be faster to attach smaller caches to individual cores for doing tasks in parallel?

    • @NomoregoodnamesD8
      @NomoregoodnamesD8 Před 6 lety

      This would make multi-threaded applications more of a nightmare to design. If Core 1 has some data Core 2 needs for an unrelated routine, it would have to stop what Core 1 is doing to request that item in the cache, or it would have to go out to RAM to get a piece of information the CPU technically already has.

  • @cgdermot
    @cgdermot Před 8 lety +6

    DUCKDUCKGO! best search engine ever :)

  • @rikschaaf
    @rikschaaf Před 8 lety

    How does cache work when considering a multi processor architecture? Is the cache shared between cores?
    What happens when another core tries to access a memory location in RAM that was cached and changed by a different core?

    • @DJSkunkieButt
      @DJSkunkieButt Před 8 lety

      Each core has its own cache and they have internal methods of synchronizing cache contents between them.

    • @rikschaaf
      @rikschaaf Před 8 lety

      That is like if I asked how gravity works, you answer that there is a certain relation between mass, distance and the gravitational force... Not that informative. The gravity case I'd like to learn the function Fg=G*m1*m2/r^2. In the case of the cache: how and when does it synchronize the cache? How can I be sure that the data is synced when it needs to be?

    • @rikschaaf
      @rikschaaf Před 8 lety

      I didn't know it was called cache coherence, so yes it was. Still, thanks for the link

    • @sundhaug92
      @sundhaug92 Před 8 lety

      +Rik Schaaf Some cache-levels are shared and programs can explicitly request that data is flushed to shared memory (L3 or RAM in this case) in addition to being able to signal to other cores "Hey, I just changed that piece of memory that we both might access"

  • @MasticinaAkicta
    @MasticinaAkicta Před 8 lety +1

    Gotta love how cache did make a difference. Going back to the Pentium 4 and the Celeron. In many ways they are the same except in cache size. Pretty much not not so succesful P4's became celerons.
    And for office tasks, light office use, it didn't matter that much. Unless you where dealing with huge sheets to work on.
    So many office pc's ended up with celerons. And that wasn't bad!
    It was slower then the P4, definitely once certain jobs really could use a bit more cache then the celeron offered.
    Of course nowadays cache also is used to connect multiple cores together. As a bridge between them. So you get a nice big swat of memory to function as shared cache for all cores. And locally a much smaller one for its local, one core only, calculations.
    So does cache influence speed? Yes but it also depends on the job it is doing. Word probably won't get much a speed boost with double the amount of cache. But encoding video, running databases or yes a huge spreadsheet then a big cache will mean more performance.

  • @FiNiTe_weeb
    @FiNiTe_weeb Před 8 lety

    I have i7 920 at 2.67GHz, if I upgrade to i7 5960X, and clock it to 2.67GHz, will there be a signnificant difference? And how much does it come from the cache?

    • @prich0382
      @prich0382 Před 7 lety

      For starters, the I7 920 is a quad core 8 Thread CPU where as the I7 5960X is a 8 Core 16 Thread BEAST. Also, the 5960X will have higher instructions per clock, higher stock and boost frequency, more Cache (20 MB vs 8MB). It'll just rek the the older CPU easily in everyway.

  • @MyLittleMagneton
    @MyLittleMagneton Před 8 lety +9

    No mention of the register :0

    • @ImKingLouie
      @ImKingLouie Před 8 lety

      +Scias The registers change context too often for it to be useful for cacheing.

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen Před 8 lety +5

      +Ali Can Metan
      Eeeh. They have similarities in the way they could be implemented in hardware, but their intent is too different to be considered the same thing.
      Caches can be addressed, registers can't. There is no instruction saying "Register A contains an address to another register. Copy the value in the register whose address is stored in A to register B." I mean... technically it would be possible if the manufacturer put in instructions for that, but you only have a few registers anyways so that would have hardly any use at all. And registers are not used in this kind of fashion. They are used to hold temporary values before you do something with them or write them back into the main memory.
      Also I'm assuming that with "registers" you mean for example EAX, EBX, ESP, ... on a x86 processor. Because the hardware used to store a bit can be called "register" too, even it if is not such a register in the processor.
      As far as I know EAX, EBX and so on are called "general purpose registers" and they are typically what you mean when you refer to the registers of a processor.

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen Před 8 lety +2

      +Ali Can Metan
      "I have always thought I was utilizing CPU cache when I used them." That's not necessarily wrong, but most likely you don't. An example: int Cube(int a) { return a * a * a; } In this case the argument a is most likely stored in a register (instead of the stack when there are a lot of arguments). Say that's EBX. The return value shall be stored in ECX. You could do something like this: Mult EAX EBX EBX; Mult ECX EAX EBX; You only access registers. The RAM and Cache are not involved. But sometimes you want to access stuff allocated on the heap: int Foo(int* a, int b) { return a[b]; } Assume a is stored in EBX, b is stored in ECX and the return value shall be stored in EDX. This could be done like this: Mult EAX ECX 4 /*sizeof int*/; Mov EDX [EBX + EAX]; Here you have to access the RAM at a + b * 4. This could be cached to save time next time you access that region of RAM. (I'll assume that whatever is passed as argument a is allocated by using some equivalent of malloc. Because if it was allocated on the stack, caching would not make a lot of sense because the stack changes too much.) The registers in both cases are just used to hold temporary values. The contents of registers are never cached unless you explicitly write them somewhere into the RAM. They don't need to be cached because they are faster than caches anyways.

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen Před 8 lety +2

      Scias
      That's why we have high-level languages :P

    • @garydunken7934
      @garydunken7934 Před 7 lety +2

      Register? I think he did mention it indirectly. That was the turnip in the back pack.
      Cache... turnip in the fridge.
      DRAM... turnip in the field.

  • @CelmorSmith
    @CelmorSmith Před 8 lety

    I like that you've put duckduckgo in the video, personally I prefer that search engine.

  • @MrGridStrom
    @MrGridStrom Před 8 lety +1

    The memory used to make CPU cache must be very robust, I know that RAM can become worn out over time. What makes CPU cache memory last so much longer than other memory types?

    • @t3hPoundcake
      @t3hPoundcake Před 8 lety

      +MrGridStrom I would guess that it has a lot to do with the fact that it's such a small amount of memory compared to DRAM, the CPU generates a lot of heat but modern heat syncs can disperse a lot of it, whereas a lot of ram relies on very small heat sinks so the heat over time may do more to damage the memory in the DRAM sets than in the CPU's cache

    • @ducksonplays4190
      @ducksonplays4190 Před 2 lety +1

      It is because CPUs use SRAM(Static Random Access Memory) instead of DRAM(Dynamic Random Access Memory) SRAM is faster than DRAM and also doesn't require refreshing allowing for higher speeds. But it is more transistors than DRAM which is why it isn't used in ram. It also uses more power.

  • @nixie2462
    @nixie2462 Před 8 lety

    Now that he has done a few videos, he is quite comfortable with the camera and talking to it. Congratulations, it's not something so easy to do.
    Now he just has to either look at you or look at the camera, try not to look around so much, and they will be perfect! ^^
    Shouldn't have to say that the video was very interesting too. :)

  • @andljoy
    @andljoy Před 8 lety

    IF it helps think of it like this , if you are doing DIY in your house you don't go and get 1 tool at a time from the shed, you get the whole tool box , you may not need every tool but its much faster than going back and forth.

  • @TechXSoftware
    @TechXSoftware Před 8 lety

    Why not combine rm and CPU?

  • @RecycleBin0
    @RecycleBin0 Před 8 lety

    apart from the cost problem, why don't we just use ONLY cache and more of it, either as part of the CPU, or externally.
    instead of using regular ram. cache would get cheaper anyhow it it were used instead of regular DDR or ECC memory.
    it may even save motherboard space compared to regular RAM but that's probably not a really severe problem.

  • @THERESAPARTYINMYHEAD
    @THERESAPARTYINMYHEAD Před 8 lety +2

    Why can't I pay extra and get a computer with 8gb cache and how much faster would by computer be if I could?

    • @lgab
      @lgab Před 8 lety +1

      +THERESAPARTYINMYHEAD Possibly a fair bit faster for some non-optimized edge-case scenarios, but your computer would be HUGE and probably cost millions. There's only a couple of megabytes of cache memory in a CPU, and the CPU already uses it well. However, cache memory doesn't work the same way as RAM so it might not even be possible, and because of that it also takes up much more physical space.

    • @candyman251
      @candyman251 Před 8 lety +9

      +THERESAPARTYINMYHEAD You actually get diminishing returns as the size of your cache increases. Think of it as searching for a book in a cart of books you recently read. If you have a huge cart, sure you can keep a lot of recently read books nearby but it will take you longer to find the specific book you need.

    • @vuurniacsquarewave5091
      @vuurniacsquarewave5091 Před 6 lety

      Is the gain coming from having to work with small addresses, or something else too? I would imagine there's never more than 24 bits needed to address cache content (not to mention special CPU instructions made to work with even smaller address sizes in exchange for greater speed)

  • @NeilRoy
    @NeilRoy Před 8 lety

    I would think the cache also helps to keep the flow of information constant without pauses "lag" etc.

    • @sundhaug92
      @sundhaug92 Před 8 lety +1

      +Neil Roy Depends. When you start to watch a video stream, some of it is put in a cache in RAM (and at various points of your connection) before you see anything, to make it more smooth, which increases the delay but makes the experience smoother (since you don't always have to wait for the next video frame to arrive from across the globe). Also, for a CPU or program to look in RAM (depending on if it's software cache or hardware cache) takes some time and might take more time than bypassing cache, for example if you have a high-speed internet connection, it might be faster to request the webpage from the server, rather than have Chrome check a huge cache.

    • @NeilRoy
      @NeilRoy Před 8 lety +1

      sundhaug92
      I recently read an excellent article on optimizing your data in your programs (I'm a programmer) and it just happened to cover CPU caches. They are quite remarkable. I learned the L1, L2 and L3 caches are labeled as such depending on how far away they are from the processor. L1 being the closest and having the fastest times to fetch data, L2 being father away, and L3 the farthest. The amount of time to fetch data from the L3 is quite considerably slower, I was surprised. I guess what happens is when the CPU reads from memory it will store that location in L1 cache. If L1 becomes full, than it will take the memory location stored in it that has been idle the longest (not accessed for the longest time) and move it to L2. The same happens if L2 is full, the oldest gets moved to L3 and eventually the oldest is removed from L3 totally. If no memory is found in any of those caches, it then fetches from RAM and the process of storing the location starts all over again. There is much more too it (memory fragmentation etc... which is what one can avoid by structuring your program properly and speed things up).
      I recall years ago, in the days of Netscape that website caches basically check the website for the page requested and check the date of that page and compare it to the page (if any) you have stored in cache. If the site's page is newer, it gets the webpage from the website, otherwise it will load in the one from the cache.
      That is my understanding of this. I imagine something similar is done for images on the webpage as well.
      With video I think it just loads as much of the video into a buffer as possible then starts playing, usually on CZcams you can see how much is being loaded ahead of time. Seeing as how videos are sequential in nature, this is probably the simplest form of caching/buffering. The CPU cache being the most involved.

  • @dos541
    @dos541 Před 8 lety +1

    I had a 73 gig cache made by google chrome The way I found out was windows media player said I was out of memory a 120 gig ssd can fill up quickly I had to enable hidden folders to finally find the file why did chrome think a 73 gig cache was necessary

  • @PrivateSi
    @PrivateSi Před 3 lety

    Simplify chips by getting rid of all general cache levels but level 1 and fixed purpose level 0 cache. Reduce instruction size to 16 bit, remove branch prediction, legacy instructions, combine GPU and CPU SIMD as an APU, with many simple cores and increase level 1 cache to fill up the rest of the chip, with some redundancy to improve yields. This architecture makes more sense as we get closer to 1nM chip fabrication. Imagine an APU with 1 GB Level 1 cache the size of a Xeon.

    • @CeezGeez
      @CeezGeez Před rokem

      nvidia / amd / intel would lose money that way that’s why we don’t see as many apus imo

    • @PrivateSi
      @PrivateSi Před rokem

      @@CeezGeez .. Intel has everything to gain. I'm one of these people who don't care about Intel's Arc discrete PCIe graphics doing well enough to be competition for AMD and nvidia because I'd rather Intel just pull the rug from under their feet with Intel APUs and an Intel-only mobo standard that has a standardised GPU die socket, like a CPU socket, and possibly a very high bandwidth VRAM socket to match. Faster CPU-GPU i/o, faster data access, with the VRAM usable by the CPU too, though at a slower speed than the GPU. PCIe wastes a lot of space and power as well as potential bandwidth.

  • @Zandonus
    @Zandonus Před 8 lety

    It did seem that my computer got significantly faster after ..well, doubling the frequency, and turning from 1mb of regular L2 cache into 3mb of "intel smart cache" What's the differrence there? Simply that the regular L2 would be split in twain for both of the cores, and that the newer one could use the whole 3 megabytes in both cores at the same time?

    • @ZipplyZane
      @ZipplyZane Před 8 lety

      +Zandonus Yip. That's all it appears to be. It allows you to not only share data between the two cores, but also have one core have any of the cache that the other core isn't using at the moment. It's like hyperthreading for cache.

  • @nestorjologs4051
    @nestorjologs4051 Před 6 měsíci

    I am wondering why copying large files takes time, but deleting it is way too fast?

  • @velocity73R
    @velocity73R Před 8 lety +3

    You can always tell when someone truly understands what they are talking about by the explanation, and this guy has that in droves ,good job!

  • @PodcastGPT
    @PodcastGPT Před 8 lety

    Hopefully in the future the cache gets to be our main memory, combined with ultra fast SSD's shit will get real.

  • @plopeye1
    @plopeye1 Před 7 lety +2

    Why a CPU needs cache? just turn the cache off in the bios and see what it's doing. (this may take some time...)

  • @chadsquires614
    @chadsquires614 Před 8 lety

    Is Steve the author of Heartbleed?

  • @itudor
    @itudor Před 8 lety

    What is +Keyori doing here?

  • @donaldkjenstad1129
    @donaldkjenstad1129 Před 8 lety

    Would you talk about predictive branching in cache pipelines.

    • @sundhaug92
      @sundhaug92 Před 8 lety

      +Donald Kjenstad (DonK) Actually, instruction pipelines aren't a part of cache, though pipelines are used to help use cache more efficiently

  • @ThePahte
    @ThePahte Před 3 lety

    I LIKE HIS SHIRT

  • @hadleyedwards222
    @hadleyedwards222 Před 8 lety

    do arm processors have cache?

  • @JoshuaBarretto
    @JoshuaBarretto Před 8 lety +2

    Wow... CPUs are far, far less stupid than I thought. I was under the impression that I knew roughly how they worked, but clearly they're far more complex than the theoretical thing I was thinking of...

    • @azaandhalla4603
      @azaandhalla4603 Před 8 lety +9

      This is a great explanation of caches but this literally scratches the surface of what a CPU does. But I'm glad you found a new respect for them they are amazing pieces of technology.

    • @umblapag
      @umblapag Před 8 lety

      Look up technical press releases of Intel chips, there's a lot going on in there nowadays in terms of cache, circuitry, division of labor between/among cores etc.

    • @JoshuaBarretto
      @JoshuaBarretto Před 8 lety

      Umbert Lapagoss I might do, I find this stuff interesting. I'm a C++ developer anyway, so knowing this stuff will help me write faster and more memory-efficient code.

  • @Antropovich
    @Antropovich Před 8 lety

    can you add caches to a PC? is there option for regular users?

    • @umblapag
      @umblapag Před 8 lety +3

      No, cache physically is built into the chip.

    • @Diggnuts
      @Diggnuts Před 8 lety

      +Antropovich A long time ago you did have motherboards that has DIP sockets for cache chips, but there days are long gone! I remember a 286 motherboard with that option. I don't know what level of cache it actually was.
      Probably the last level before checking main memory.

    • @angeldude101
      @angeldude101 Před 8 lety

      +Antropovich No, but the CPU that you buy or that comes with your computer already has caches built-in.

    • @Antropovich
      @Antropovich Před 8 lety

      yeah, thought so. I wanted to know if there was a mdel that could somehow change caches.

  • @desolatorXT
    @desolatorXT Před 8 lety

    What about Level 1,2 or 3 caches? What's their difference?

    • @CC-wc2ro
      @CC-wc2ro Před 8 lety +3

      +desolator XT higher level caches are larger but slower. if the CPU misses lower level cache it uses higher level cache and if all caches are missed it uses main memory

    • @WickedMuis
      @WickedMuis Před 8 lety +1

      +desolator XT I think that comes down to complexity and purpose.

    • @oldmanmarsh2528
      @oldmanmarsh2528 Před 8 lety

      +33C0C3 The higher level caches are also further away, so by the laws of physics they take longer to access. This is also one of the reasons why having caches are super important on modern computers, the processors are fast enough to make the distance between processor and memory count.
      There's also typically a separate L1 cache for each core of the CPU. I believe the L2 and L3 caches are always shared between all cores.

  • @DrumRoody
    @DrumRoody Před 6 lety

    I'm gonna need about 64gb of level 1 cache please.

  • @umblapag
    @umblapag Před 8 lety +34

    DuckDuckGo!

  • @dbsirius
    @dbsirius Před 8 lety

    I had to drive to the address to get the cache, but it wouldn't open so i used the ram.

  • @mikamodric4135
    @mikamodric4135 Před 5 lety +1

    which do i need to buy i3 8350k ( 4.0 Ghz, L3 : 8 MB cache) or amd ryzen 2600X ( 3,4Ghz.- L3: 19 MB cache ) .
    Note : I am 2d autocad user. thank you for your answers

  • @SteinGauslaaStrindhaug
    @SteinGauslaaStrindhaug Před 8 lety +1

    Second level turnip cache... For some reason I find that very funny

  • @satellite964
    @satellite964 Před 8 lety +2

    Dr Steve "Heartbleed" Bagley looks like a character out of Lord of the Rings.

  • @gblargg
    @gblargg Před 8 lety

    So really, the answer isn't that memory didn't keep up, that technically we can't do it, but simply that the cost of RAM as fast as the CPU combined with the amount of memory modern tasks use left room for a cheaper solution in the form of a small amount of very fast memory, a moderate amount of medium-speed memory (main RAM), and slower mass-storage (HDD, SSD). We could have a machine with 16 gigs of super-fast RAM but the performance increase would be moderate compared to the extreme cost.
    More abstractly, we've always had cache in the form of a multi-level memory scheme, and this is just further stratification of it. Even the original computers had the online storage of bits it was working on, and humans with the rest of the data, with a slow link between them. The 1980s computers shown had a few levels: CPU with its registers, main memory, and cartridge/tape storage. There's a tradeoff between size of storage and cost of fast access, and many tasks naturally use a small portion at a time, so you use it as cache for the larger one.
    Looked at from the other direction, it wasn't cache that we added, as the fastest memory kept up with CPUs, and its size has stayed fairly similar (even modern CPUs have the L1 cache around 32K, like home computers had of fast main memory); rather, we've *added* a huge later bank of RAM to modern computers, between the fast memory the CPU uses and the slower mass-storage.

  • @BasemSayej
    @BasemSayej Před 7 lety

    in Australia they pronounce it keish

  • @zeuglcockatrice4633
    @zeuglcockatrice4633 Před 8 lety

    So...there's a turnip growing in my cpu???It explains those artifacts I gotta give it some water,or even better delete system32 to give it more space to grow.

  • @Roflcopter4b
    @Roflcopter4b Před 8 lety

    What's the difference between cache and a register?

    • @joeybeauvais-feisthauer3137
      @joeybeauvais-feisthauer3137 Před 8 lety +4

      +Roflcopter4b Registers are where the CPU stores its working variables. It is the fastest memory to be accessed, but typically only contains a handful of bytes per register, and not many registers. A cache is much larger, up to some megabytes, and stores frequently accessed memory. It is much slower than registers, but much faster than RAM.

    • @RWoody1995
      @RWoody1995 Před 8 lety +1

      +Roflcopter4b registers hold the actual state of the CPU at a given time, to analogise this to a human being, a register could be the position of your arm or what smell your nose just picked up for example, whereas the cache is like a human beings sensory/short term memory holding info about remembering where your arm just was a second ago and what that smell was just a second ago, then ram is like medium term memory, what you expect to be doing in the not too distant future and then the hard drive being long term memory with all the info you have in total.

    • @sundhaug92
      @sundhaug92 Před 8 lety

      +Roflcopter4b Cache is usually not addressed to explicitly, it's not something the programmer can manage (though there are exceptions, such as the PS3), though one could think of registers as explicitly addressed "L0"-cache

  • @MaddTheSane
    @MaddTheSane Před 7 lety

    No mention of external caches? I know Apple used it for their early PowerPC computers.

  • @firestarspelt
    @firestarspelt Před 8 lety

    16 gig dimms i coulda sworn ive seen a 128 gb dimm for servers somewhere

  • @vorkev1
    @vorkev1 Před 7 lety

    we do not need Cach it is all depending on how the computer works. I need that one of the collages I will not name as I may get in trouble for it . Well that collage is working on a computer that will use 1 chip for memory this chip is your hard drive you ram and your system and cpu cache what this is is a single chip system for memory. Its realy cool how it works yes you would think it will slow things and yes it can but what is cool about it is down the line say a faster chip comes out for the memory but you cpu is fast enuff to run stuff well you can replace that chip with a faster bigger chip save mony doing it and get faster speeds.

  • @mibdev
    @mibdev Před 7 lety

    I don't know, why?

  • @RWoody1995
    @RWoody1995 Před 8 lety

    I wonder, since RAM has actually caught up with the CPU again where a current generation intel cpu can accept RAM with clock speeds of up to 3GHz without going into overclocking, pretty much the same clock speed as the cpu itself, why is the cache still faster even if the cpu is running at that same 3GHz?

    • @sundhaug92
      @sundhaug92 Před 8 lety

      +megaspeed2v2 For one, latency

    • @ZipplyZane
      @ZipplyZane Před 8 lety

      +megaspeed2v2 A huge part of the reason that the cache is faster is that it's physically closer to the CPU. It takes time to get your request all the way out to the normal memory and all the way back to the CPU.
      I think that is what +sundhaug92 is referring to when he mentions latency.

    • @RWoody1995
      @RWoody1995 Před 8 lety

      ZipplyZane yes it was, i understand the latency aspect as it helps when accessing lots of little pieces of data but whenever larger amounts of data are being accessed wouldn't for example 3GHz ram coupled with a 3GHz CPU no longer have a bottleneck as the ram can throw out data quickly enough to use up the entire CPU time in short bursts rather than the cpu having to wait for a few million clock cycles between transfers

  • @DanLMH
    @DanLMH Před 8 lety +2

    When your CPU has 15MB of L3 Cache

  • @MagikGimp
    @MagikGimp Před 8 lety

    Why are the analogies always so archaic?