Chapter2 Memory Hierarchy Design

下图展示了多层次存储结构
在这里插入图片描述
随着Flash和下一代存储技术缩小磁盘每一bit代价的的差距,这种技术更喜欢增加代替磁盘而不是中间存储。
因为高速存储比较贵,存储结构安排到多个等级,每一级比下一级更小,更快,每byte更贵。
如果在缓存中找不到某一个字,就必须从结构层次较低的层次去找这个字,并把它放在缓存中。一次操作最小为一个cache line。有三种方式:直接映射缓存,全相连,组相连。
为了衡量不同缓存组织方式的优劣,一种3C模式将这些缺失场景分为以下三个简单的类别:
1、强制:对一个数据块的第一次访问,这个块不可能在缓存中,所以必须将这个快调度缓存中。
2、容量:如果缓存不能包含程序运行期间所需要的全部块,就会因为有些块呗放弃,之后再被调入,从而导致容量的缺失
3、冲突:如果块放置不是全相连的,如果多个映射到一个块的组中,对不同的块的访问混在一起,一个块可能会被放弃,然后在被调度,从而发生冲突缺失。
在这里插入图片描述
在这里插入图片描述
缓存性能的10中高级优化方法
分为以下5类:
(1)缩短命中时间
(2)增加缓存带宽
(3)降低缺失代价
(4)降低缺失率
(5)通过并行降低缺失代价或缺失率
一、小而简单的一级缓存,用以缩短命中时间、降低功耗
二、采用路预测以缩短命中时间
三、实现缓存访问的流水化,以提高缓存带宽
四、采用无阻塞缓存,以提高缓存带宽
五、采用多种缓存以提高缓存带宽
六、关键字优先和提前重启动以降低缺失代价
七、合并写缓冲区以降低缺失代价
八、采用编译器优化以降低缺失率
九、对指令和数据进行硬件预取,以降低缺失代价或缺失率
十、用编译器控制预取,以降低缺失代价或缺失率
“+”表明该技术改进该项因素。“-”代表恶化
在这里插入图片描述

存储器技术与优化
存储器的延迟主要有两部分组成——访问时间和周期时间。
访问时间是指发出读取请求到收到所需字之间的时间,周期时间是指对存储器发出两次不想管请求之间的最短时间。
一般使用DRAM作为主存,SRAM作为缓存,在处理器芯片中集成一到三级缓存,与CPU集成在一起。

DRAM技术
现在行选通(RAS)期间发送一半地址,然后在列选通(CAS)期间发送另一半地址。
DRAM仅使用一个晶体管来存储以为数据,信息在读取的过程会破坏改信息,所以必须进行恢复,这是DRAM周期时间一般要长于访问时间的原因之一。
DRAM访问分为行和列,DRAM必须在DRAM内部缓冲一行中的所有为,为列访问做好准备。一行的数据通常等于DRAM大小的平方根,不如4Mbit DRAM的每行有2Kbit。随着DRAM的增大,添加了一些附加结果,提高带宽的可能性。
一、添加定时信号,允许重复访问行缓冲区—>DRAM
二、接口添加时钟信号 —>SDRAM
三、增加位宽
四、双沿传输 —>DDR SDRAM

闪存EEPROM,可读,带电可擦除
(1)在写之前,必须对其进行擦除,擦除过程是按块进行的。
(2)闪存是静态的
(3)提供写入周期优先,这样,系统可以确保写入块平均分布在整个存储器中,最大程度延长闪存系统的寿命
(4)比SDRAM便宜,比磁盘柜
(5)速度比SDRAM慢,比磁盘快
可使用奇偶校验,ECC,Chipkill来检测和纠正,一般采用ECC。

通过虚拟存储器提供保护
目前用的最多的机制是添加对虚拟存储器各个页面的保护。这些保护性限制包含在每个页表项中,保护性限制可以决定一个用户进程能否读取这个页面,一个用户进程是否写这个页面以及能否从这个页面执行代码。此外,如果一个进程没有包含在页表中,那它就既不能读取也不能写入一个页面。由于只有操作系统才能更新页表,所以分页机制提供了全面的访问保护。
页表数据部分保存物理页地址、保护字段、有效位,通常还有一个使用位和一个更改位。

交叉问题:存储器层侧结构的设计
1、保护和指令集体系结构
2、缓存数据的一致性

Memory hierarchy management refers to the process of organizing and managing the different levels of memory in a computer system, including the cache, main memory, and secondary storage. The goal of memory hierarchy management is to optimize the use of memory resources and improve system performance. This is achieved through a combination of hardware and software techniques that help to minimize the amount of time it takes to access data from memory. At the lowest level of the memory hierarchy is the main memory, which is typically implemented using dynamic random-access memory (DRAM) chips. Main memory is fast but expensive, so it is relatively small compared to the amount of data that needs to be stored in a typical computer system. To make up for the limited capacity of main memory, computer systems use caching techniques to store frequently accessed data in a faster, smaller cache memory. The cache is typically implemented using static random-access memory (SRAM) chips, which are much faster than DRAM but more expensive. Memory hierarchy management involves coordinating the movement of data between the different levels of the memory hierarchy, based on factors such as the frequency of access, the size of the data, and the available memory resources. This is done using algorithms such as cache replacement policies, which determine which data should be evicted from the cache to make room for new data. Other memory management techniques include virtual memory, which allows the operating system to use secondary storage as an extension of main memory, and memory compression, which compresses data in memory to free up space for additional data. Overall, memory hierarchy management is critical to the performance and efficiency of modern computer systems, and requires a careful balance of hardware and software optimizations to achieve optimal results.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值