前言

本文试图搞清楚cache几个操作:clean、invalidate与flush的含义。由于只用过ARM和RISC-V,所以是从ARM和RISC-V的角度来说明。

cache line

cache line是cache的基本访问单元。

cache line一般都会包含valid和dirty两个状态位,如下图的v和d。

valid位表示当前cache line的内容是否有效。dirty位表示当前cache line的内容是否比内存上的要更新(即是否修改过)。

cache操作

clean和invalidata两个操作都可以在ARM官方文档上找到描述,但是flush没找到。而RISC-V则都没找到。

clean

clean表示把cache line的dirty位清0,并把cache line的数据同步到内存上,目的是保证cache与内存的数据一致性。仅适用于使用回写(write-back)策略的D-cache。

Applies to write-back data caches, and means that if the cache line contains stored data that has not yet been written out to main memory, it is written to main memory now, and the line is marked as clean.

invalidate

invalidate表示把cache line的valid位清0。

Means that the cache line (or all the lines in the cache) is marked as invalid, so that no cache hits occur for that line until it is re-allocated to an address. For write-back data caches, this does not include cleaning the cache line unless that is also stated.

flush

flush有查到两种含义:

  • flush = invalidate

在《arm system developer‘s guide》中有描述到:

The term invalidate is sometimes used in place of the term flush.

  • flush = clean + invalidate

SiFive(提供基于RISC-V指令集CPU IP的公司)关于cache有一条自定义命令:CFLUSH.D.L1,其中有描述:

writes back and invalidates line(s) in the L1 data cache

所以这里flush相当于clean + invalidate。

参考资料

《ARM Architecture Reference Manual (2nd Edition)》

《ARM System Developer‘s Guide》

《SiFive E76-MC Core Complex Manual》

cache操作:clean、invalidate与flush的含义的更多相关文章

  1. 使用Django.core.cache操作Memcached导致性能不稳定的分析过程

    使用Django.core.cache操作Memcached导致性能不稳定的分析过程 最近测试一项目,用到了Nginx缓存服务,那可真是快啊!2Gb带宽都轻易耗尽. 不过Api接口无法简单使用Ngin ...

  2. 命令学习_IPCONFIG: DNS cache操作

    IPCONFIG: DNS cache操作 Windows会将解析到的DNS信息缓存,这个机制可以加速重复的域名访问.从DNS Server返回的DNS Response消息中带有"Time ...

  3. Multi-processor having shared memory, private cache memories, and invalidate queues having valid bits and flush bits for serializing transactions

    Multi-processor systems are often implemented using a common system bus as the communication mechani ...

  4. 使用.net的Cache框架快速实现Cache操作

    本文转载自:http://www.cnblogs.com/TianFang/p/3430169.html .NET 4.0中新增了一个System.Runtime.Caching的名字空间,它提供了一 ...

  5. C#语法糖之 cache操作类 asp.net

    因为考虑到我下面我将写session cookies 等 操作类 ,与cache具有共性. 所以都统一继承了IHttpStorageObject  abstract class 来保函数风格的统一 , ...

  6. php定时执行操作及ob_flush()与flush()的使用

    版权声明:本文为博主原创文章,未经博主允许不得转载. http://blog.csdn.net/qq_38125058 一: 每隔30s执行一次,将字符串写入文件 // 30秒执行一次 ignore_ ...

  7. springBoot cache操作2

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zxd1435513775/article/details/85091793一.基本项目搭建测试项目是 ...

  8. Cache操作类

    封装类: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Sys ...

  9. SpringBoot 结合 Spring Cache 操作 Redis 实现数据缓存

    系统环境: Redis 版本:5.0.7 SpringBoot 版本:2.2.2.RELEASE 参考地址: Redus 官方网址:https://redis.io/ 博文示例项目 Github 地址 ...

  10. magento缓存系列详解:clean cache

    cache是一个很大的概念,涉及的内容方方面面,magento cache是基于zend的,如果你对zend cache理解很深的话,相信magento cache也不再话下,本篇文章着重介绍Flus ...

随机推荐

  1. 在Vue2和Vue3中JSX的使用集锦

    Vue2安装JSX支持 有时候,我们使用渲染函数(render function)来抽象组件,而渲染函数使用Vue的h函数来编写Dom元素相对template语法差别较大,体验不佳,这个时候就派 JS ...

  2. oracle优化-分页查询新认识

    在写这篇文章之前,对分页查询的认识就是经典的三层嵌套:第①层:获得需要的数据,第②层:用rownum限制展示数据的上限,第③层:用rownum的别名rn限制展示数据的下限. 在生产中遇见一个两层嵌套满 ...

  3. Ubuntu 14.04解决登录界面无限循环的方法

    在Ubuntu下配置Android的环境时,想像在Windows中那样在终端中直接启动adb,以为Linux和Windows一样,将adb的路径添加到环境变量中,于是将adb的路径也export到/e ...

  4. About Info-ZIP

    LATEST RELEASES: Zip 3.00 was released on 7 July 2008. WiZ 5.03 was released on 11 March 2005. UnZip ...

  5. 俄罗斯版IDM安装与破解以及解决B站视频网站不弹出下载浮窗

    IDM 全称 Internet Download Manager,是一款非常优秀的多线程下载和视频嗅探工具,不仅可以显著提高文件下载速度,配合IDM浏览器扩展插件,还可以嗅探并下载YouTube.知乎 ...

  6. D 算法模板(Boruvka's Algorithm)

    Description 为了方便你测试,本题为D题简化版. You are given a complete undirected graph with nn vertices. A number a ...

  7. sql删除进程

    使用一下语句杀掉进程 USE master go DECLARE @dbname VARCHAR(200) SET @dbname = 'xxxx' --要关闭进程的数据库名 DECLARE @sql ...

  8. [C++]P3384 轻重链剖分(树链剖分)

    [C++]树链剖分 预备知识 树的基础知识 关于这个本文有介绍 邻接表存图 线段树基础 会区间加法和区间结合就可以了P3372 建议阅读这篇Blog 最近公共祖先LCA 虽然用不到这个思想 但是有类似 ...

  9. websocket和ajax的区别(和http的区别)

    websocket和ajax的区别(和http的区别) https://segmentfault.com/a/1190000021741131 1. 本质不同 ajax,即异步JavaScript和X ...

  10. OpenGL 基础光照详解

    1. 光照 显示世界中,光照环境往往是相对复杂的.因为假设太阳作为世界的唯一光源,那么太阳光照在物体A上A将阳光进行反射后,A又做为一个新的光源共同作用于另一个物体B.所以于B来讲光源是复杂的.然而这 ...