プリンキピア

第5章アルゴリズムのハードウェアによる実現:コンピューターシステム設計

5.5 Memory Hierarchy5.5 メモリ階層

Learning Objectives学習目標
By the end of this section, you will be able to:
この節を終えると、次のことができるようになる。
• Discuss various memory and storage tools
• さまざまなメモリとストレージについて論じる。
• Differentiate between various types of storage technologies
• ストレージ技術のさまざまな種類を区別する。
• Explain how locality is used to optimize programs
• 局所性がプログラムの最適化にどう使われるか説明する。
For the processor to do its job, which is doing the calculations, it must be fed instructions and data. This means the overall performance depends on both the calculation’s speed and the speed by which data and instructions are received. No matter how fast your processor is, you do not get good performance if the stream of instructions and data is not fast enough. Everything worked well in the early days of computing, from the 1940s until the early 1990s, and then computing hit a wall—a memory wall.
英語のヒント
プロセッサが計算という仕事をするには、命令とデータを供給される必要がある。つまり、全体の性能は、計算の速さと、データや命令を受け取る速さの両方によって決まる。プロセッサがどれだけ速くても、命令とデータの流れが十分に速くなければ、よい性能は得られない。コンピューティングの初期、1940年代から1990年代初頭まではすべて順調だったが、その後、コンピューティングは壁、すなわち「メモリの壁」に突き当たった。
Researchers in industry and academia achieved good leaps in performance for processors by innovating ways to use transistors provided to them by Moore’s law. They used those transistors, which were doubling per chip on average every 18 months, to add more features to the processor leading to better processor performance. However, the same was not done with memory, which resulted in a speed up gap between memory and processor. The gap started small and then got wider until it became a bottleneck of performance. Figure 5.19 shows the trend in the processor-memory performance gap.
英語のヒント
産業界と学術界の研究者は、ムーアの法則によって利用できるようになったトランジスタの使い方を工夫し、プロセッサの性能を大きく向上させた。チップ当たりのトランジスタ数は平均18か月で倍増しており、それらを使ってプロセッサに機能を追加することで、性能を高めた。しかし、メモリでは同じようには進まず、メモリとプロセッサの間に高速化の差が生まれた。差は初め小さかったものの、しだいに広がり、性能のボトルネックとなった。図5.19は、プロセッサとメモリの性能差の推移を示している。
Figure 5.19

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典

Figure 5.19 The gap between processor speed and memory speed is increasing. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図5.19 プロセッサとメモリの速度の差は、拡大している。(出典:著作権 Rice University、OpenStax。CC BY 4.0ライセンス)
In this section, we explore memory technology. We will discuss the different technologies by which memory is built, explain what we mean by memory hierarchy, and see what researchers have done to deal with the processor-memory gap.
英語のヒント
この節では、メモリ技術を調べる。メモリを作るさまざまな技術を論じ、メモリ階層とは何かを説明し、プロセッサとメモリの差に対処するために研究者が行ってきたことを見ていく。

Memory and Storageメモリとストレージ

What is our wish list for the perfect memory? Probably speed—we want a fast memory. But be careful—memory speed is different from memory capacity. Memory capacity has increased throughout the years at a much faster rate than memory speed. We also want infinite capacity and persistence; that is, when the power is off, we want the memory to keep its content.
英語のヒント
理想のメモリに何を求めるだろうか。おそらく、まず速度である。高速なメモリが欲しいはずである。ただし、メモリの速度と容量は違うことに注意しよう。長年にわたり、メモリ容量は速度よりずっと速いペースで増えてきた。また、無限の容量と持続的な保持も求める。つまり、電源を切っても、内容を保持していてほしいのだ。
Next, we want to be able to pack a large amount of storage in as small an area as possible via density, which comes in handy especially for portable devices such as your smartwatch or smartphone. And what about the cost? If the memory is very expensive, the whole computer system is very expensive which means that nobody buys it; designers then have to put a smaller memory size into the computer system to keep the price low. But smaller memory means less functionality to the computer system and lower overall performance.
英語のヒント
次に、密度を高めて、できるだけ小さな面積に大量の記憶領域を詰め込みたいと思う。これは特に、スマートウォッチやスマートフォンのような携帯機器で便利である。費用はどうだろうか。メモリが非常に高価なら、コンピューターシステム全体も高価になり、誰も買わなくなる。そのため、設計者は価格を抑えるために、搭載するメモリ容量を小さくしなければならない。しかし、メモリが小さければ、コンピューターの機能が制限され、全体の性能も低くなる。
The reality is much less ideal. There is no single technology that excels in all these aspects. Some technologies are fast but more expensive, volatile, and less dense, while others are cheap and persistent but are relatively slower than other technologies. If we pick only one technology, we end up with a non-functional system. For example, if we pick the fast and volatile but expensive technology, the resulting computing system, which is probably very expensive, needs to be powered on indefinitely in order to retain the data. If we pick the persistent and cheap but slow technology, the system may be unusable due to its slow speed.
英語のヒント
現実は、それほど理想的ではない。これらすべての面で優れた単独の技術はない。高速でも高価で、揮発性があり、密度の低い技術もあれば、安価でデータを保持できても、ほかの技術より比較的遅いものもある。一つの技術だけを選ぶと、機能しないシステムになってしまう。たとえば、高速で揮発性があり、高価な技術を選ぶと、できあがったコンピューターはおそらく非常に高価なうえ、データを保持するために、ずっと電源を入れておく必要がある。データを保持できて安価でも、遅い技術を選ぶと、速度が遅すぎて使いものにならないかもしれない。
The word storage is usually used with persistence (long-term storage) while the word memory is used for volatility (short-term storage) even though this distinction may be blurred in future technologies. How can we get the best of both worlds?
英語のヒント
通常、ストレージという語は持続的な保持、つまり長期保存に使い、メモリという語は揮発性、つまり短期保存に使う。ただし、将来の技術では、この区別が曖昧になるかもしれない。どうすれば、両方のよいところを得られるだろうか。
CONCEPTS IN PRACTICE概念を実践する
The More You Know知識が増えるほど
Knowing about hardware is always beneficial to a software programmer. The cache, for example, is transparent to the programmer; however, if the programmer knows about the cache and how it works, they can write code that exhibits locality and gets good performance.
英語のヒント
ハードウェアを知ることは、ソフトウェアのプログラマーにとって、常に有益である。たとえば、キャッシュはプログラマーからは見えないものだが、キャッシュとその動作を知っていれば、局所性を持ち、よい性能を得られるコードを書ける。
If you are writing a program that accesses a matrix, and you know how the matrix is stored in memory, you can adjust your code to access the matrix row by row (or column by column) to increase the locality which makes your program much faster.
英語のヒント
行列にアクセスするプログラムを書いていて、その行列がメモリにどう保存されているかを知っていれば、1行ずつ、あるいは1列ずつアクセスするようにコードを調整できる。それによって局所性が高まり、プログラムが大幅に速くなる。