前言

本文试图搞清楚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. 分库表数据倾斜的处理让我联想到了AKF模型

    1 背景 最近在做需求的时候需要在一张表中增加一个字段. 这张表情况如下: 1.拆分了多个库多张表 2.库表拆分按表中商户编码字段hash之后取模进行拆分 由于库表拆分按照商户编码,有些大商家的单子数 ...

  2. 一篇文章让你弄懂分布式一致性协议Paxos

    一.Paxos协议简介 Paxos算法由Leslie Lamport在1990年提出,它是少数在工程实践中被证实的强一致性.高可用.去中心的分布式协议.Paxos协议用于在多个副本之间在有限时间内对某 ...

  3. 大模型时代,如何快速开发AI应用

    本文分享自华为云社区 <[云享问答]第3期:大模型时代,如何快速开发AI应用>,作者:华为云社区精选. 大模型快速普及应用的当下,AI浪潮汹涌而至,对于开发者来说,开发一款属于自己的AI应 ...

  4. HashMap底层源码分析

    HashMap底层原理实现 1.HashMap初始化 jdk1.8版本之后:数组+链表+红黑树实现,先去观看HashMap的构造方法: 构造方法: public HashMap() { this.lo ...

  5. FreeSWITCH添加h264编码及pcap视频提取

    操作系统 :CentOS 7.6_x64.Windows 10_x64 FreeSWITCH版本 :1.10.9 Python版本:3.9.2 一.启用h264相关模块 这里以 mod_openh26 ...

  6. Android历史版本

    目录 [隐藏]  1 测试版 2 版本列表 2.1 Android 1.0 2.2 Android 1.1 2.3 Android 1.5 Cupcake 2.4 Android 1.6 Donut ...

  7. Educational Codeforces Round 148 [Rated for Div. 2]A~C

    A #include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 60; char c ...

  8. 实战攻防演练--利用微软自带Certutil命令ByPassAV上传C2

    Certutil Certutil.exe是Windows操作系统中的合法程序,主要用于管理证书相关操作.它提供了转储和显示证书颁发机构(CA)的配置信息.配置证书服务.备份和还原CA组件,以及验证证 ...

  9. springcloud/springboot集成NACOS 做注册和配置中心以及nacos源码分析

    一.SpringCloud 简介 Spring Cloud 是一系列框架的有序集合如服务发现注册.配置中心.消息总线.负载均衡.熔断器.数据监控等. SpringCloud 将多个服务框架组合起来,通 ...

  10. MyBatis拦截器优雅实现数据脱敏

    背景 现代网络环境中,敏感数据的处理是至关重要的.敏感数据包括个人身份信息.银行账号.手机号码等,泄露这些数据可能导致用户隐私泄露.财产损失等严重后果.因此,对敏感数据进行脱敏处理是一种必要的安全措施 ...