首页 > 其他分享 >CS:APP--Chapter06 : memory hierarchy(part 2)

CS:APP--Chapter06 : memory hierarchy(part 2)

时间:2023-01-17 21:44:19浏览次数:41  
标签:locality -- APP cache Chapter06 hierarchy memory accessed data

CS:APP--Chapter06 : memory hierarchy(part 2)

标签(空格分隔): CS:APP

目录


2. Locality

How to exhibit a good locality is one of our goals when we are writing code. This kind of code always accesses data items either that are near the most recently accessed data items or that were recently accessed themselves.

According to it, locality is described as two distinct forms : temporal locality and spatial locality.

type description
temporar locality the accessed data item is likely to be accessed again multiple times in the near future
spatial locality the data item that is near the recently accessed data item is likely to be accessed in the near future

There is a giant advantage of good locality :
the program with good locality must run faster than one with poor locality. It's an effective approach that optimizes program.

2.1 locality of reference to program data

good temporar locality usually with loop

good spatial locality usually with less stride as loop proceeds

2.2 locality of instruction fetches

As same as reference to program data

The introduction has come so far in this time in moving onto the introduction of memory hierarchy.

3. the memory hierarchy

Admittedly, the trade-off between speed and volume (cost as well) always gets in the way of developing higher-performance storage devices.

3.1 caching in the memory hierarchy

memory hierarchy

What can it happen if there is no cache between the register and memory?
The gap in the processing speed between the register and main memory results in a big problem here.

cache bridges the gap in terms of speed and cost.

cache hits

cache misses

kind of cache misses

cache management

标签:locality,--,APP,cache,Chapter06,hierarchy,memory,accessed,data
From: https://www.cnblogs.com/UQ-44636346/p/17058749.html

相关文章

  • 将一定范围的值 放在数组中
    packagecom.fqs.demo;publicclassfangArray{publicstaticvoidmain(String[]args){//将100到105的数放数组中inta=100;//开始的值包......
  • SpringCloud GateWay网关(入门)
    1、介绍强烈推荐,看官网文档SpringCloudGateway①简介Cloud全家桶里有个重要组件:网关SpringCloudGateway基于WebFlux框架WebFlux底层使用高性能的Reactor模式(异步......
  • Python中reshape函数(-1表示什么)
    https://blog.sciencenet.cn/blog-3428464-1247194.html reshape函数(-1表示什么)1.当原始数组A[4,6]为二维数组,代表4行6列。A.reshape(-1,8):表示将数组转换成8列的数组......
  • 验证表的伪列rowid在主备库的一致性
    文档课题:验证表的伪列rowid在主备库的一致性.数据库:oracle11.2.0.4环境:主库orcl150,备库orcl151应用场景:主库检测出存在坏块,若表存在索引.此时可以在主库确认出坏块对应的......
  • EXPDP之INCLUDE参数解析
    文档课题:EXPDP之INCLUDE参数解析.应用场景:将A库某schema中的部分表导入到B库某schema中.语法如下:1INCLUDE=object_type[:name_clause][,...]测试过程:数据库:oracle11.2.......
  • 执行explain plan语句时报错ora-12838
    问题描述:执行explainplan语句时报错ora-12838,如下所示:HR@orcl150>insert/*+APPENDPARALLEL*/intot_hr_20230117_new(id,time)select*fromt_hr_20230117;86396ro......
  • 「解题报告」ARC142D Deterministic Placing
    好?首先我们可以发现,第一步和第三步的局面必须相等,因为第二步可以反着走回第一步,如果不相等那么下一步走的方案就不唯一了。然后我们考虑走的形式,由于是一棵树,没有环,我们......
  • 求某个数,是否是质数
    packagecom.fqs.demo;publicclassZhiNumber{publicstaticvoidmain(String[]args){//计算某个数是否是质数能被1和自身除时余数为0;被其他数......
  • LINUX-QT串口操作
    接收显示控件   添加串口模块  添加头文件  在头文件中声明一个函数  使用声明的函数  在mainwindow中进行调用InitUI  voidMainW......
  • CSRF及SSRF漏洞案例
    CSRF漏洞:攻击者盗用了你的身份,以你的名义发送恶意请求,对服务器来说这个请求是完全合法的,但是却完成了攻击者所期望的一个操作,比如以你的名义发送邮件、发消息,盗取你的账号,......