ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

[mmu/cache]-cache的一些基本概念介绍

2021-06-22 14:03:32  阅读:371  来源: 互联网

标签:Cache mmu cache PoU 分配 memory line 基本概念


快速链接:
.
???????????? 个人博客笔记导读目录(全部) ????????????

文章目录

1、Cache的一些基本概念

(1)、cache的架构图(L1、L2、L3 cache)

在这里插入图片描述

(2)、cache的术语:set/way/line/index/tag/offset

在这里插入图片描述

2、Cache的一些属性概念

Cache分配策略(Cache allocation policy)

cache的分配策略是指我们什么情况下应该为数据分配cache line。cache分配策略分为读和写两种情况。

(1)、读分配(read allocation)

当CPU读数据时,发生cache缺失,这种情况下都会分配一个cache line缓存从主存读取的数据。默认情况下,cache都支持读分配。

(2)、写分配(write allocation)

当CPU写数据发生cache缺失时,才会考虑写分配策略。当我们不支持写分配的情况下,写指令只会更新主存数据,然后就结束了。当支持写分配的时候,我们首先从主存中加载数据到cache line中(相当于先做个读分配动作),然后会更新cache line中的数据。

Cache更新策略(Cache update policy)

cache更新策略是指当发生cache命中时,写操作应该如何更新数据。cache更新策略分成两种:写直通和回写。

(3)、写直通(write through)

当CPU执行store指令并在cache命中时,我们更新cache中的数据并且更新主存中的数据。cache和主存的数据始终保持一致。
在这里插入图片描述

(4)、写回(write back)

当CPU执行store指令并在cache命中时,我们只更新cache中的数据。并且每个cache line中会有一个bit位记录数据是否被修改过,称之为dirty bit(翻翻前面的图片,cache line旁边有一个D就是dirty bit)。我们会将dirty bit置位。主存中的数据只会在cache line被替换或者显示的clean操作时更新。因此,主存中的数据可能是未修改的数据,而修改的数据躺在cache中。cache和主存的数据可能不一致。
在这里插入图片描述

properties of normal memory
(5)、inner and outer

在这里插入图片描述

PoC 和 PoU
(6) Poc

Poc是值对于不同的Master看到的一致性的内存; 例如对于cores,DSP,DMA他们一致性的内存就是main memory,所以main memory是PoC这个点

Point of Coherency (PoC). For a particular address, the PoC is the point at which all
observers, for example, cores, DSPs, or DMA engines, that can access memory, are
guaranteed to see the same copy of a memory location. Typically, this is the main external
system memory

在这里插入图片描述

(6) PoU

PoU是值指令和数据cache上一致的那个点,一般为L2 cache,如果系统中没有L2 cache,那么PoU为main memory

Point of Unification (PoU). The PoU for a core is the point at which the instruction and
data caches and translation table walks of the core are guaranteed to see the same copy of
a memory location. For example, a unified level 2 cache would be the point of unification
in a system with Harvard level 1 caches and a TLB for caching translation table entries.
If no external cache is present, main memory would be the Point of Unification

在这里插入图片描述

3、cache的使用示例

(1)、一个两路组相连的cache

在这里插入图片描述

(2)、一个32kb 四路组相连的cache

在这里插入图片描述

(3)、Inclusive 和 exclusive cache

wwww

标签:Cache,mmu,cache,PoU,分配,memory,line,基本概念
来源: https://blog.51cto.com/u_15278218/2936788

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有