Cache不命中的分类 Categories of Cache misses

本文探讨了计算机系统中缓存管理的基本概念,包括强制性缺失(首次访问必须将块加载到缓存)、容量缺失(当缓存无法容纳所有所需块时会丢弃部分缓存项)及冲突缺失(间接映射或组相联缓存中多个块映射到同一位置导致的问题)。这些概念对于理解缓存的工作原理及其对程序执行效率的影响至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. compulsory: the first time to access one block, the block must be brought into the cache
  2. capacity: blocks are discarded from cache, because cache can't contain all the blocks needed by one program execution
  3. conflict: In direct-mapped or set-associative cache, when blocks are mapped into the same set or block fram.
For Instructors: Courses Based on the Book Instructors can use the CS:APP book to teach a number of different types of systems courses. Five categories of these courses are illustrated in Figure 2. The particular course depends on curriculum requirements, personal taste, and the backgrounds and abilities of the students. From left to right in the figure, the courses are characterized by an increasing emphasis on the programmer’s perspective of a system. Here is a brief description. ORG. A computer organization course with traditional topics covered in an untraditional style. Traditional topics such as logic design, processor architecture, assembly language, and memory systems are covered. However, there is more emphasis on the impact for the programmer. For example, data representations are related back to the data types and operations of C programs, and the presentation on assembly code is based on machine code generated by a C compiler rather than handwritten assembly code. ORG+. The ORG course with additional emphasis on the impact of hardware on the performance of application programs. Compared to ORG, students learn more about code optimization and about improving the memory performance of their C programs. ICS. The baseline ICS course, designed to produce enlightened programmers who understand the impact of the hardware, operating system, and compilation system on the performance and correctness of their application programs. A significant difference from ORG+ is that low-level processor architecture is not covered. Instead, programmers work with a higher-level model of a modern out-of-order processor. The ICS course fits nicely into a 10-week quarter, and can also be stretched to a 15-week semester if covered at a more leisurely pace. ICS+. The baseline ICS course with additional coverage of systems programming topics such as system-level I/O, network programming, and concurrent programming. This is the semester-long Carnegie Mellon course, which covers every chapter in CS:APP except low-level processor architecture.翻译以上英文为中文
最新发布
08-05
### 缓存写操作未命中时的处理策略 在计算机科学中,当发生缓存写未命中(write miss)时,有几种常见的处理方法来决定如何更新缓存和内存中的数据。这些策略主要分为两类:写分配(Write Allocate)与写分配(No Write Allocate),以及在此基础上进一步细分的具体机制。 #### 写分配 (Write Allocate) 在这种模式下,如果检测到一次写入请求未能找到对应的缓存在本地存储器内,则会先加载该地址的数据块进入缓存再执行实际修改动作。此过程通常涉及从较低层次的记忆体读取整个行并将其放置于高速缓冲区之中;之后允许对该位置实施正常的写入流程[^1]。 对于采用这种方式的情况,在完成更改后还需要考虑何时同步回主存的问题——这又引入了两种子类别: - **写穿透(Write Through)**: 每次成功地向缓存进行了写入的同时也会立即把相同的变化反映给背后更慢速但容量更大的持久化层。 - **写回(Write Back)** 或者称为延迟写入(Lazy Writing): 只是在最近使用的页面上记录变动而马上传播出去直到确实必要为止(比如因为替换算法选择了这个条目被驱逐)。 #### 写分配 (No Write Allocate / Write No Allocate) 相比之下,“写分配”的做法更为简单粗暴一些。它意味着每当遇到此类情形时试图预先填充缺失的部分而是直接越过当前级别的临时储存结构而针对最终目标进行必要的变更工作。这意味着任何新创建出来的对象都会自动成为后续快速访问路径的一部分除非它们后来通过其他途径自然流入其中。 这种方案可以减少必要的带宽消耗但也可能导致更多的随机访存开销特别是在频繁覆盖同一区域的情形之下。 ```c++ // C++ Example demonstrating basic concept of handling write misses using Write Allocate strategy. void handle_write_miss_with_allocate(address_t addr, data_t value){ // Load the block containing 'addr' into cache first load_block_into_cache(addr); // Then perform the actual write operation within cached memory space modify_cached_data_at_address(addr,value); } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值