Memory System Desiderata
1,The memory system has three desiderata.
(1)Size:infinitely large,no constraints on program or data set size.
(2)Speed:infinitely fast,latency equal to the fastest memory technology available[1].
(3)Cost:the per bit cost should approach the lowest-cost technology available.
Clearly these specifications cannot all be achieved as they are mutually exclusive.However,with the semiconductor and magnetic memory technology of today,these specifications are closely approximated.
2.Hierarchical Memory
In this section it is shown how designers implement a practical memory that approaches the performance of an ideal memory at reasonable cost.This memory system has a hierarchy of levels:The memory closest to the processor is fast and relatively small,but has a high cost per bit.This level is called the cache;The real memory,sometimes known as main memory,is slower,larger,and has a lower cost per bit than the cache;The lowest level in the hierarchy is usually a magnetic disk that has the longest latency and the lowest bandwidth;however,it can be very large and has a very low cost per bit.This hierarchy is illustrated in Fig. 1-9.

Note that Fig. 1-9 does not include the processor register file in the memory hierarchy.[2] The register file is a program-managed cache and is generally not included in the memory system. Also,there can be more than one cache in the hierarchy.
3.Paged Virtual Memory
Paged virtual memory provides the solution to the first desideratum of a very large memory’ s being available to the processor.Because of the importance of this desideratum,the relationship between virtual and real memory is discussed first. With virtual memory,the processor addresses the disk,the large,slow end of the hierarchy.[3] The memories between the processor and the disk are there to increase the effective performance(reduced latency and increased bandwidth)of the very slow disk.If every instruction and data reference were made to the disk,the processor performance would be slow indeed.
Then why is virtual memory so important?Large memory is needed for large programs and data sets. Early computers with small real memory required that the transfer of data between real memory and disk be managed explicitly by the operating system or the user. Virtual memory provides for automatic management of this portion of the memory hierarchy through a combination of hardware and software aids.
The virtual memory interface is shown in Fig. 1-10. A real memory of 16M bytes and a virtual memory of 2G bytes are shown for illustration;many modern virtual-memory systems are much larger than this.Virtual-memory space is divided into equal-sized groups called pages. A page in a modern computer is 1K,2K,or 4K bytes. Real memory is also divided into the same equal-sized groups,called page frames. When information is moved between virtual-memory space and real-memory space,a complete page is moved.
存储系统
1.存储系统的需求
存储系统有以下3项需求。
(1)容量:无限大,对程序和数据集大小没有任何约束。
(2)速度:无限快,等待时间在现有存储器技术下是最短的。
(3)价格:每位的价格在可使用的技术中应接近最低。
很明显,由于这3个需求相互制约,所以很难全部满足。不过随着半导体和磁存储技术的发展,这些需求几近满足。
2.存储的层次结构
下面说明设计者如何在合理的价格下设计出性能理想的实际存储器。这一存储系统具有下述层次结构:最靠近处理器的是快速、容量相对小,但每位价格高的存储器,这一级叫做高速缓冲存储器;下一级是实存储器,有时也称为主存储器,是速度较低、容量较大、每位价格比高速缓存低的存储器;层次结构中最低一层通常是等待时间最长,带宽最窄的磁盘;但它的容量非常大,每位价格非常低,如图1-9所示。
请注意,图1-9中没有包括存储器层次结构中的处理器寄存器组。寄存器组是程序控制的高速缓存,一般不包括在存储系统中。此外,在存储器层次中可以有不只一个高速缓存。
3.页式虚拟存储器
页式虚拟存储器为处理器可用的超大的存储器容量的需求提供了解决办法。由于这一需求很重要,故先讨论虚拟存储器与实存储器之间的关系。处理器以虚拟存储器的方式访问位于层次结构最底层的大容量、低速磁盘。在处理器和磁盘之间放置存储器是为了提高低速磁盘的有效性能(减少等待时间和增加带宽)。如果每条指令和数据引用都要访问磁盘,则处理器的性能必定很差。
那么为什么虚拟存储器如此重要?大型程序和数据集需要大容量存储器。早期的计算机实存储器容量很小,要求由操作系统或用户直接管理实存储器和磁盘之间的数据传送。虚拟存储器通过硬件和软件的结合自动地管理存储器层次结构的这一部分。
虚拟存储器接口如图1-10所示,图中画出了16MB实存储器和2GB虚拟存储器;现在很多虚拟存储器系统的容量都比它大很多。虚拟存储器空间被分成多个相同容量的组,称为页面。现在计算机的页面大小是1KB、2KB或4KB。实存储器也被分成多个容量相同的组,叫做页帧。信息是整页整页地在虚拟存储器和实存储器之间传送的。