第5章アルゴリズムのハードウェアによる実現:コンピューターシステム設計
5.2 Computer Levels of Abstraction5.2 コンピューターの抽象化レベル
Learning Objectives学習目標
By the end of this section, you will be able to:
この節を学び終えると、次のことができるようになる。
• Describe abstraction levels from the highest to the lowest
• 最も高いレベルから最も低いレベルまでの抽象化を説明する。
• Explain application programs abstractions in relation to HLLs and instruction set architectures
• HLLと命令セットアーキテクチャーに関連づけて、アプリケーションプログラムの抽象化を説明する。
• Discuss processor abstractions and how microarchitecture supports them
• プロセッサの抽象化と、それをマイクロアーキテクチャーがどう支えるかを論じる。
• Identify the role of the operating system within abstraction
• 抽象化の中でオペレーティングシステムが担う役割を特定する。
• Discuss examples of new disruptive computer systems
• 新しい破壊的なコンピューターシステムの例について論じる。
When you look around, you see that complex systems can be viewed as layers of abstractions. The removal of unimportant elements of a program or computer code that distract from its process is called abstraction. This way of looking at complex systems makes it easier to understand them. For example, cars are very complicated inventions. At the highest level of abstraction, we look at a car as a set of devices used to operate it such as a steering wheel, brake and accelerator pedals, and so on. If we go to a lower level, we see devices that power the car such as its engine, gears, and spark plugs. If we take these parts and look at how they are designed, then we are at an even lower level where we see metals, plastics, and other materials. The same approach can be applied to computers to understand how they work. We can see computers as several layers of abstractions, as shown in Figure 5.5. For the remaining part of this section, we start from the highest level and then work through each abstraction layer to illustrate how it is used as a building block by the layer before it.
英語のヒント
周囲を見渡すと、複雑なシステムは抽象化の層として捉えられることがわかる。プログラムやコンピューターのコードから、その処理を理解する妨げになる重要でない要素を取り除くことを、抽象化という。複雑なシステムをこのように捉えると、理解しやすくなる。たとえば、自動車は非常に複雑な発明品である。最も高い抽象化レベルでは、自動車を、ハンドル、ブレーキペダル、アクセルペダルなどの操作装置の集まりとして見る。一段低いレベルに進むと、エンジン、ギア、点火プラグなど、自動車を動かす装置が見えてくる。さらに、それらの部品がどう設計されているかを見ると、金属、プラスチックなどの材料が見える、いっそう低いレベルに進む。同じ方法をコンピューターにも適用すれば、その仕組みを理解できる。図5.5のように、コンピューターもいくつもの抽象化の層として捉えられる。この節の残りでは、最も高いレベルから各層を順にたどり、それぞれの層が、その一つ前に見た層の構成要素としてどう使われているかを示す。

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典
Figure 5.5 A computer system can be viewed at several levels of abstraction, each one layered on top of the other. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図5.5 コンピューターシステムは、いくつもの抽象化レベルで捉えることができ、それぞれの層は別の層の上に重なっている。(出典:著作権 Rice University、OpenStax。CC BY 4.0ライセンス)
Computers are just a tool used to solve a problem. You may use computers to play games or listen to music, and in these cases, the problems that the computer is trying to solve are associated with programs that you use for entertainment purposes.
英語のヒント
コンピューターは、問題を解くために使う道具にすぎない。ゲームや音楽を楽しむために使うこともあるだろう。その場合、コンピューターが解こうとしている問題は、娯楽のために使うプログラムに関係している。
The top line in Figure 5.5 starts with the problem; we must have a very precise definition of the problem we are trying to solve with a computer. So, the first step in solving a problem with a computer is to know exactly, and with no vagueness, what we are trying to solve. You cannot make a computer solve a problem unless there is a defined and repeatable set of instructions to solve the problem. You may wonder then why it is necessary to use a computer in the first place if you can solve the problem yourself. Well, computers do not get bored, are precise, and can deal with very large problems. This is why, the next step after problem definition is to lay out the steps for solving the problem. This solution layout is called an algorithm. The algorithm is written in free format; that is, it can be steps written as a bulleted list, it can be a flowchart, or it can be a series of mathematical equations. Regardless of the format you choose for writing the algorithm, the algorithm needs to have a key set of characteristics.
英語のヒント
図5.5の最上段は、問題から始まっている。コンピューターで解こうとする問題は、きわめて正確に定義しなければならない。したがって、コンピューターで問題を解く最初の段階は、何を解こうとしているかを、曖昧さなく正確に把握することである。問題を解くための、明確に定められた繰り返し実行可能な命令の集まりがなければ、コンピューターにその問題を解かせることはできない。自分で解けるなら、そもそもなぜコンピューターを使う必要があるのか、と思うかもしれない。コンピューターは退屈せず、正確で、非常に大きな問題も扱える。そこで、問題の定義の次に、その問題を解く手順を示す。この解決手順をアルゴリズムという。アルゴリズムの記述形式は自由である。つまり、箇条書きの手順でも、フローチャートでも、数式の列でもかまわない。どの形式を選んでも、アルゴリズムは、いくつかの重要な特性を備える必要がある。
The first characteristic is that an algorithm must be unambiguous. Each step of the algorithm must be very well defined and precise. The second characteristic is that the algorithm must be deterministic to be reproducible and repeatable so that the same set of inputs produce the same output. The third characteristic is that the algorithm, when implemented on a computer, must consume a reasonable amount of time and storage based on the problem needs. For example, an algorithm can be finite and precise, but if it requires 100 years to generate a result, it is clearly useless. For instance, an algorithm that counts the number of even numbers is not finite because we have an infinite number of even numbers.
英語のヒント
第一の特性は、アルゴリズムに曖昧さがないことである。それぞれの手順が、明確かつ正確に定められていなければならない。第二の特性は、再現可能で繰り返し実行できるように、決定的であることである。つまり、同じ入力の組からは同じ出力が得られる必要がある。第三の特性は、コンピューター上に実装したとき、問題の要件に照らして妥当な時間と記憶容量で済むことである。たとえば、有限で正確なアルゴリズムでも、結果を出すのに100年かかるなら、明らかに役に立たない。また、偶数はいくらでも存在するので、偶数の個数を数えるアルゴリズムは有限ではない。
Assuming we have an algorithm, we then need to prepare it for execution on the computer. First, we must prepare the input before it is ready to be consumed by the computer, so we give the algorithm to a programmer whose job it is to read the algorithm, understand it, and then write a program in a known computer language such as C/C++ or Python. The program tells the computer what to do, but in a formal way rather than a freeform way as an algorithm. At that point, we move to another level of abstraction.
英語のヒント
アルゴリズムができたとすると、次はコンピューターで実行する準備をする必要がある。まず、コンピューターが扱える状態になるように入力を準備する。そこで、アルゴリズムをプログラマーに渡す。プログラマーの仕事は、それを読んで理解し、C/C++やPythonなどの既知のコンピューター言語でプログラムを書くことである。プログラムは、コンピューターに何をするかを伝えるが、アルゴリズムの自由な形式とは異なり、形式に従って記述する。ここで、別の抽象化レベルへ移ることになる。

credit: “Programmer Flat Set” by Macrovector_official/FreePik, CC BY 2.0 · CC BY 2.0 · Source出典
Figure 5.6 The resulting program is consumable by a computer during and after testing. (credit: “Programmer Flat Set” by Macrovector_official/FreePik, CC BY 2.0)
図5.6 作成されたプログラムは、テスト中もテスト後もコンピューターが処理できるものになる。(クレジット:「Programmer Flat Set」、Macrovector_official/FreePik、CC BY 2.0)