What Every Programmer Should Know About Memory
Ulrich Drepper
Red Hat, Inc.
drepper@redhat.com
In the early days computers were much simpler. The various components of a system, such as the CPU, memory,mass storage, and network interfaces, were developed together and, as a result, were quite balanced in their performance.For example, the memory and network interfaces were not (much) faster than the CPU at providing data.
早期计算机更简单。一个系统的不同组件,比如CPU,内存,大容量存储和网络接口都是一同设计的,因此,它们在性能方面是很平衡的。例如,在提供数据方面,内存和网络接口比CPU快不了多少。
This situation changed once the basic structure of computers stabilized and hardware developers concentrated on optimizing individual subsystems. Suddenly the performance of some components of the computer fell significantly behind and bottlenecks developed. This was especially true for mass storage and memory subsystems which, for cost reasons, improved more slowly relative to other components.
计算机曾经稳定的基本结构已经发生了改变,硬件开发者开始集中精力优化独立的子系统。突然之间,部分组件的性能严重落后,并且出现了瓶颈。对于大容量存储和内存子系统来说这种情况尤为明显,因为成本的原因,相对于其它组件来说,它们提升的更慢。
The slowness of mass storage has mostly been dealt with using software techniques: operating systems keep most often used (and most likely to be used) data in main memory,which can be accessed at a rate orders of magnitude faster than the hard disk. Cache storage was added to the storage devices themselves, which requires no changes in the operating system to increase performance.For the purposes of this paper, we will not go into more details of software optimizations for the mass storage access.
通常使用软件技术来处理大容量存储的性能问题,操作系统将最常使用的数据(也是最有可能被使用)放在比硬盘访问速度高几个数量级的主内存中。高速缓存存储器被加入到存储设备中,而这些不需要改变操作系统就能够提升性能。出于本文的目的,我们不会深入讲述大容量存储访问的软件优化技术。