什么是cache
To minimize the quantity of control information stored, the spatial locality property is used to group several locations together under the same tag. This logical block is commonly known as a cache line.
When data is loaded into a cache, access times for subsequent loads and stores are reduced, resulting in overall performance benefits. An access to information already in a cache is known as a cache hit, and other accesses are called cache misses.

在S32K1xx的RM中可以看到。

This device includes one 4 KB code cache to minimize the performance impact of memory access latencies. The code cache exists on the I/D bus, and there is no cache on the system bus.

Cache的主要作用是降低访问主存(一般size都比较大)时的延迟。尤其是我们访问硬盘时,如果速度过慢,特别影响性能。当然,硬盘不是主存,这是另外一个话题。

Cache的存在对于用户是不可见的,只有的极少量的场合软件才需要去控制它。

对于一些嵌入式系统,我们似乎对这种性能的优化要小心。但是这种性能的优化导致的时间的不确定性能够以其他方式去解决。

WT = Write through, no write allocate.

WBWA = Write back, write allocate.

Write-allocate (WA)
In a write-allocate cache, a cache miss on storing data causes a cache line to be allocated into the cache.
在这种类型的cache(物理实体)中,发生了一个cache miss的事件,会导致 一块 logical block(也就是cache line)被分配。

Write-back (WB)
In a write-back cache, data is only written to main memory when it is forced out of the cache on line replacement following a cache miss. Otherwise, writes by the processor only update the cache. This is also known as copyback.

英语阅读理解:line replacement following a cache miss, 意思是cache miss发生之后会 line replacement。
cache miss followed by line replacement.

Write-through (WT) In a write-through cache, data is written to main memory at the same time as the cache is updated.
写的时候同步写入到主存。

Wikipedia中的词条中指出,TLB也是一种cache。
Other types of caches exist (that are not counted towards the "cache size" of the most important caches mentioned above), such as the translation lookaside buffer (TLB) which is part of the memory management unit (MMU) which most CPUs have.

所以,很多概念容易混淆。

参考资料:

https://en.wikipedia.org/wiki/CPU_cache

《Cortex-M0 Devices Generic User Guide》2009 ARM Limited.

什么是cache的更多相关文章

  1. ASP.NET Core 折腾笔记二:自己写个完整的Cache缓存类来支持.NET Core

    背景: 1:.NET Core 已经没System.Web,也木有了HttpRuntime.Cache,因此,该空间下Cache也木有了. 2:.NET Core 有新的Memory Cache提供, ...

  2. [Java 缓存] Java Cache之 DCache的简单应用.

    前言 上次总结了下本地缓存Guava Cache的简单应用, 这次来继续说下项目中使用的DCache的简单使用. 这里分为几部分进行总结, 1)DCache介绍; 2)DCache配置及使用; 3)使 ...

  3. Spring cache简单使用guava cache

    Spring cache简单使用 前言 spring有一套和各种缓存的集成方式.类似于sl4j,你可以选择log框架实现,也一样可以实现缓存实现,比如ehcache,guava cache. [TOC ...

  4. 笔记:Memory Notification: Library Cache Object loaded into SGA

    笔记:Memory Notification: Library Cache Object loaded into SGA在警告日志中发现一些这样的警告信息:Mon Nov 21 14:24:22 20 ...

  5. ABP源码分析十三:缓存Cache实现

    ABP中有两种cache的实现方式:MemroyCache 和 RedisCache. 如下图,两者都继承至ICache接口(准确说是CacheBase抽象类).ABP核心模块封装了MemroyCac ...

  6. [Java 缓存] Java Cache之 Guava Cache的简单应用.

    前言 今天第一次使用MarkDown的形式发博客. 准备记录一下自己对Guava Cache的认识及项目中的实际使用经验. 一: 什么是Guava Guava工程包含了若干被Google的 Java项 ...

  7. ASP.NET MVC5+EF6+EasyUI 后台管理系统(40)-精准在线人数统计实现-【过滤器+Cache】

    系列目录 上次的探讨没有任何结果,我浏览了大量的文章和个别系统的参考!决定用Cache来做,这可能有点难以接受但是配合mvc过滤器来做效果非常好! 由于之前的过滤器我们用过了OnActionExecu ...

  8. HTML5离线缓存(Application Cache)

    HTML5离线缓存又名Application Cache,是从浏览器的缓存中分出来的一块缓存区,要想在这个缓存中保存数据,可以使用一个描述文件(manifest file),列出要下载和缓存的资源. ...

  9. 第三篇 Entity Framework Plus 之 Query Cache

    离上一篇博客,快一周,工作太忙,只能利用休息日来写一些跟大家分享,Entity Framework Plus 组件系列文章,之前已经写过两篇 第一篇 Entity Framework Plus 之 A ...

  10. HTML5应用程序缓存Application Cache

    什么是Application Cache HTML5引入了应用程序缓存技术,意味着web应用可进行缓存,并在没有网络的情况下使用,通过创建cache manifest文件,可以轻松的创建离线应用. A ...

随机推荐

  1. Postgresql动态共享内存类型

    一.简介 linux为多个进程通信提供了不同的IPC机制,如:System V , POSIX 和 MMAP,所以Postgresql共享内存管理也支持以上类型. 在Postgresql中可以使用dy ...

  2. 【Linux SPI】RFID RC522 设备驱动

    一.概述 MFRC522 支持 SPI.I2C.UART 接口,我在某宝上购买了一个 SPI 接口的 RC522 模块.此笔记主要要是通过 RC522 模块学习 linux 中的 SPI 驱动,方便今 ...

  3. LeetCode-794 有效的井字游戏

    来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/valid-tic-tac-toe-state 题目描述 用字符串数组作为井字游戏的游戏板 boa ...

  4. pat乙级 1018 锤子 剪刀 布

    #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int ...

  5. Ubuntu命令安装默认支持的Qt5版本

    1.前置依赖 sudo apt install build-essential sudo apt install cmake 2.只安装默认的Qt模块 # 安装默认SDK # Ubuntu18.04中 ...

  6. ASP.NET Core 部署在Docker容器当中(1)

    一.前言 在公司新项目中,果断选择使用asp.net core,通过实践学习一系列技术栈:docker.docker-nginx.docker-compose.Jenkins,本文主要是介绍如何将项目 ...

  7. x-sheet 开发系列教程:初始化配置

    介绍 x-sheet 是一款高性能 Web JavaScript Canvas 电子表格,之前小编写过一篇 x-sheet 入门体验,简单介绍了一下如何使用 x-sheet.这次我们继续深入一下,了解 ...

  8. Win10中找回曾复制过的东西

    按Win+V,如果弹出的"剪贴板历史"设置已经打开,那么就可以找回.建议大家打开这项设置以防万一.

  9. BDD测试和TDD测试

    BDD测试和TDD测试 TDD TDD是测试驱动开发(Test-Driven Development)的缩写,是敏捷开发中的一项测试技术,也是一种设计方法论.她的大概思路是:先针对每个功能点抽象出接口 ...

  10. 第1关—print()函数与转换

    Print()函数的用法有以下几种:单枪匹马--不带引号.搭配单引号.搭配双引号.搭配三引号,我们逐个见识下吧!  1.无引号       注意,这里的括号一定要用[英文括号],不然会报错 impor ...