深入理解计算机系统:1.6 存储设备的层级(Storage Devices Form a Hierarchy)

1.6 存储设备的层级

一般的情况,会选择在处理器和大容量速度慢的存储设备之间增加一个小容量速度快的存储设备,事实上,在每一台计算机系统中存储设备的层级关系如图1.9所示。当我们从层级的顶端到底层,设备的容量会越来越大,速度越来越慢,价格越来越便宜。寄存器作为层级的顶端,也是第0级或L0.这里展示的是高速缓存的L1~L3,主存在第4层,本地硬盘在第5层,外设在第6层。

在这里插入图片描述

存储设备分层的主要目的是高一层的存储作为低一层的高速缓存。然后,寄存器是L1层的高速缓存,L2,L3层的高速缓存分别是L1和L2。L3层作为主存的高速缓存,而主存又是本地硬盘的高速缓存。在一些网络的分布式文件系统,本地硬盘服务就是其他系统的高速缓存。

正如可以利用不同的高速缓存知识来提高性能一样,程序员可以利用对整个存储层级的理解来达到这个目标。第6章我会将会介绍更多关于存储层级的内容。

1.6 Storage Devices Form a Hierarchy

This notion of inserting a smaller, faster storage device (e.g., cachememory) between the processor and a larger, slower device (e.g.,main memory) turns out to be a general idea. In fact, the storagedevices in every computer system are organized as a memoryhierarchy similar to Figure 1.9 . As we move from the top of thehierarchy to the bottom, the devices become slower, larger, and lesscostly per byte. The register file occupies the top level in the hierarchy,which is known as level 0 or L0. We show three levels of caching L1 toL3, occupying memory hierarchy levels 1 to 3. Main memory occupieslevel 4, and so on.

The main idea of a memory hierarchy is that storage at one level serves as a cache for storage at the next lower level. Thus, the register file is a cache for the L1 cache. Caches L1 and L2 are caches for L2 and L3, respectively. The L3 cache is a cache for the main memory, which is a cache for the disk. On some networked systems with distributed file systems, the local disk serves as a cache for data stored on the disks of other systems.

Just as programmers can exploit knowledge of the different caches to improve performance, programmers can exploit their understanding of the entire memory hierarchy. Chapter 6 will have much more to sayabout this.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值