zoukankan      html  css  js  c++  java
  • cache

    When the CPU is instructed by a load instruction to read a word from ad-
    dress A of main memory, it sends the address A to the cache. If the cache is holding
    a copy of the word at address A, it sends the word immediately back to the CPU

    So how does the cache know whether it contains a copy of the word at address A?

    here is some cache parameters you need to know 

    the way how the address match which part of the cache

    1)先从cache了解有(S,E,B)判断set有多少位,assoc有多少位,block有多少位

    2)假设block有b位,则有连续的2^n个位置都是属于这个set,假如cache为空,我们现在要地址0的内容,cpu先向cache发送地址0,cache未能命中,则向内存中发出读地址0命令,将地址0的内容写入set0,在这个读内存的过程中,cache还连带的把地址1、2、3

    的内容读入到cache中。假如下一次cpu需要地址2的内容就可以直接从cache中读取。

    3)那assoc有什么用呢!假如cpu需要地址8的内容,而且地址8和地址0都是用到set0。如果E只有0位那么就先要吧set0原先的内容踢掉,再去加载地址8的内容,如果E有1位,cpu如果需要地址8的内容就可以直接把地址8的内容加载到line2中,同样的在加载地址8时,cache顺便的把地址9、a、b的内容加载到cache中

  • 相关阅读:
    生活有时候就是个戏本
    Android dp、dpi、px
    iOS10以后相机、相册等授权问题
    iOS圆角性能问题
    激荡10年,珍贵的毕业礼物
    Android API 指南
    Android 配置
    Android Error
    安卓 MIUI真机测试
    iOS 同一段文字显示不同颜色
  • 原文地址:https://www.cnblogs.com/been/p/3917097.html
Copyright © 2011-2022 走看看