CPU cache

A CPU cache is a cache used by the central processing unit (CPU) of a computer to reduce the average time to access data from the main memory. The cache is a smaller, faster memory which stores copies of the data from frequently used main memory locations.

Data is transferred between memory and cache in blocks of fixed size, called cache lines.


Most modern desktop and server CPUs have at least three independent caches: an instruction cache to speed up executable instruction fetch, a **data cache **to speed up data fetch and store, and a translation lookaside buffer (TLB) used to speed up virtual-to-physical address translation for both executable instructions and data.

The data cache is usually organized as** a hierarchy of more cache levels** (L1, L2, etc.; see also multi-level caches below). However, **a TLB cache is part of the memory management unit (MMU) **and not directly related to the CPU caches.

The proportion of accesses that result in a cache hit is known as the hit rate, and can be a measure of the effectiveness of the cache for a given program or algorithm.

Read misses delay execution because of requiring data to be transferred from memory, which is much slower than reading from the cache. Write misses may occur without such penalty, since the processor can continue execution while data is copied to main memory in the background.

写缺失:CPU更新内存数据中,在Cache中没有找到相关数据(地址和数值)。

Cache写机制:Write-through与Write-back

参考文献:Modern Hardware

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • 知君以罪死——清明将至,愿以此书寄予我已故十二年的父亲! 1、 我的肉体得救了,灵魂却受了伤; 我的灵魂得救了,肉...
    山展一田夫阅读 643评论 0 0
  • · 关于恋爱 · 1.别因为心软接受一个人。当因感动产生的悸动消退后,很长一段时间你会为自己草率答应在一起而后悔。...
    猫妮喵喵阅读 137评论 0 0
  • 这句话,不只是滋养人的心灵鸡汤,而是,世间的因果。今天和一位朋友聊的很好,也达成了合作,在结果没有呈现之前,也许,...
    大红小绿阅读 501评论 0 0