本章重点应该是Cache。
    Cache由SRAM搭建,因为SRAM速度可以与处理器媲美。Cache可以有多级。
    如果Cache中有相应数据,则cache hit,直接从cache中取数据。否则从main memory(DRAM)中取数据,路径长,比较慢,则cache miss。

    在上世纪70年代和80年代早期,DRAM还可以跟上处理器的速度,但现在速度太慢了。DRAM访问时间比处理器周期时间长一到两个数量级(数十纳秒,相比之下不足一纳秒)。
    image.png内存访问顺序
    image.png各种存储的重要参数
    Average memory access time (AMAT) is the average time a processor must wait for memory per load or store instruction.image.png
    MM-main memory
    VM-virtual memory on the hard disk
    虚拟内存别称虚拟存储器(Virtual Memory),是计算机系统内存管理的一种技术。它使得应用程序认为它拥有连续的可用的内存(一个连续完整的地址空间)。
    主存是指电脑内存,辅存主要只的是电脑里面的硬盘,虚拟存储器(VM)是指在内存不够计算机使用的情况下,在硬盘上开辟一个区域,当作内存使用。举例,在硬盘的C盘上开辟一个空间,当内存不够使用的时候,计算机把它当作内存使用。

    Amdahl’s Law-阿姆达尔定律
    该定律是指:系统中对某一部件采用更快执行方式所能获得的系统性能改进程度,取决于这种执行方式被使用的频率,或所占总执行时间的比例。阿姆达尔定律实际上定义了采取增强(加速)某部分功能处理的措施后可获得的性能改进或执行时间的加速比。简单来说是通过更快的处理器来获得加速是由慢的系统组件所限制。
    (系统论的绝妙观点)
    只有当子系统对整体性能的影响很大时,才值得为提高子系统的性能而付出努力。(课本解释)
    image.png课本中Cache的分类方式,从右往左数,第3位到第5位用于定义Set的序号
    Most commercial systems use set associative caches.
    Cache结构的分类image.png
    image.png
    如果块太大,可能由于miss penalty(罚金)导致时间消耗增加。

    替换策略
    a least recently used (LRU) replacement policy.或者使用伪LRU策略,替换最近使用的组中最少使用的块。
    写回测量
    write back和write through
    在回写策略(write back)下,只有当物理页从物理内存中被逐出时,才将其写回硬盘驱动器。

    Note that the ADC has a confusing use of the terms sampling rate and sampling time.
    The sampling time, also called the acquisition time, is the amount of time necessary for
    the input to settle before conversion takes place. The sampling rate is the number of samples taken per second. It is at most 1/(sampling time + 12 TAD).

    本书使用很大的篇幅去讲I/O,也就是将微机原理和数字信号处理,这部分内容已经系统学习过,所以只需要略看。
    结尾处作者畅游古今,以饱含深意的忠告结尾。With your newfound power comes profound responsibility.We hope that you will use it, not just for fun and riches, but also for the benefit of humanity.随着你新获得的权力,随之而来的是深刻的责任。我们希望你能利用它,不只是为了娱乐和财富,也为了人类的利益。

    Q1Cache中的数据应该遵循什么规则?
    A1通过以下提问来解决
    (1) What data is held in the cache?
    (2) How is data found?
    (3) What data is replaced to make room for new data when the cache is full?

    Q2时间上和空间上局域性的应用
    A2image.png
    The principle of using larger block sizes to exploit spatial locality also applies to associative caches.

    Epilogue-结语
    cubicle-小卧室、小隔间
    metaphor-暗喻、隐喻
    While in graduate school-在读研究生的时候
    adjacent-邻近的
    evit-逐出

    //全书完