cache操作:clean、invalidate与flush的含义
前言
本文试图搞清楚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的含义的更多相关文章
- 使用Django.core.cache操作Memcached导致性能不稳定的分析过程
使用Django.core.cache操作Memcached导致性能不稳定的分析过程 最近测试一项目,用到了Nginx缓存服务,那可真是快啊!2Gb带宽都轻易耗尽. 不过Api接口无法简单使用Ngin ...
- 命令学习_IPCONFIG: DNS cache操作
IPCONFIG: DNS cache操作 Windows会将解析到的DNS信息缓存,这个机制可以加速重复的域名访问.从DNS Server返回的DNS Response消息中带有"Time ...
- 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 ...
- 使用.net的Cache框架快速实现Cache操作
本文转载自:http://www.cnblogs.com/TianFang/p/3430169.html .NET 4.0中新增了一个System.Runtime.Caching的名字空间,它提供了一 ...
- C#语法糖之 cache操作类 asp.net
因为考虑到我下面我将写session cookies 等 操作类 ,与cache具有共性. 所以都统一继承了IHttpStorageObject abstract class 来保函数风格的统一 , ...
- php定时执行操作及ob_flush()与flush()的使用
版权声明:本文为博主原创文章,未经博主允许不得转载. http://blog.csdn.net/qq_38125058 一: 每隔30s执行一次,将字符串写入文件 // 30秒执行一次 ignore_ ...
- springBoot cache操作2
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zxd1435513775/article/details/85091793一.基本项目搭建测试项目是 ...
- Cache操作类
封装类: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Sys ...
- SpringBoot 结合 Spring Cache 操作 Redis 实现数据缓存
系统环境: Redis 版本:5.0.7 SpringBoot 版本:2.2.2.RELEASE 参考地址: Redus 官方网址:https://redis.io/ 博文示例项目 Github 地址 ...
- magento缓存系列详解:clean cache
cache是一个很大的概念,涉及的内容方方面面,magento cache是基于zend的,如果你对zend cache理解很深的话,相信magento cache也不再话下,本篇文章着重介绍Flus ...
随机推荐
- Solution -「CSP-S 2020」函数调用
Description 大家应该都读过题. Solution 赛后变摩托. 我们对每一个操作 \(3\) 连边建图,然后可以知道只是一个 \(\texttt{DAG}\). 考虑操作 \(2\),我们 ...
- IDEA2019 Debug傻瓜式上手教程
Step Into (F7):步入,如果当前行有方法,可以进入方法内部,一般用于进入自定义方法内,不会进入官方类库的方法. Force Step Into (Alt + Shift + F7) ...
- 用MMCls训练手势模型
import os import json import mmcv import time from mmcv import Config from mmdet.apis import inferen ...
- Chapter 6. Build Script Basics
Chapter 6. Build Script Basics 6.1. Projects and tasks Everything in Gradle sits on top of two basic ...
- MySQL PXC集群新增一个高版本节点
已有的一个 MySQL PXC 集群环境,因为种种原因仅剩一个节点 node1,需要新增一个集群节点 node2. node1 版本:donor version (8.0.21) node2 版本:l ...
- 使用 Alacritty 替代 Gnome-Terminal 解决 Ubuntu 中终端的行间距问题
我之前发了一篇随笔新版 Ubuntu 中 gnome-terminal 可恶的行间距问题逼我退回了 Ubuntu 20.04,描述了新版 Ubuntu 中终端的行间距问题.评论中给出了一个解决办法,那 ...
- ts 终于搞懂TS中的泛型啦! | typescript 入门指南 04
大家好,我是王天~ 这篇文章是 ts入门指南系列中第四篇,主要讲解ts中的泛型应用,泛型在ts中是比较重要的概念,我花挺长时间才搞明白的,希望能帮助到大家 ~ ** ts 入门指南系列 ** Ts和J ...
- mysqli操作
1.使用mysqli_connect()函数,语法如下: mysqli 对象名=mysqli_connect(数据库服务名,用户名,密码,数据库名) 例:$conn=mysqli_connect('l ...
- PolygonCollider2D.OverlapPoint()在小scale下失效的一种解决办法
偶然发现PolygonCollider2D的方法OverlapPoint()有时会失效(一直返回false),测试后发现在scale(这里指世界空间的scale,后同)很小的情况下(通常在UI Can ...
- 通义千问, 文心一言, ChatGLM, GPT-4, Llama2, DevOps 能力评测
引言 "克隆 dev 环境到 test 环境,等所有服务运行正常之后,把访问地址告诉我","检查所有项目,告诉我有哪些服务不正常,给出异常原因和修复建议",在过 ...