markdown
計算機システムの基本md b8b634f
lecture/information/systems/computer-systems-basics.lecture.n.md
Download PDF

計算機けいさんきシステムの基本きほん

date2026-07-14document_iddoc_081f8ffb84ffda562468ed65e53d2fdfdescription計算機システムをCPU・メモリ・入出力の協調として捉え、命令サイクル、記憶階層、性能評価の基本を説明する。prerequisitesプログラミングの基本 / 二進表現と論理演算の初歩type講義statusactiverelateddata/lecture/information/systems/computer-systems-portal.lecture.n.md / data/lecture/information/programming/introduction-to-programming.lecture.n.md / data/lecture/information/algorithm/foundation/computational-complexity-basics.lecture.n.md / data/lecture/information/networks/computer-networks-portal.lecture.n.md
informationsystemsundergraduatelecture
data/lecture/information/systems/computer-systems-portal.lecture.n.md

1導入どうにゅう

この講義こうぎでは、CPUCentral Processing Unit主記憶しゅきおくMain memory入出力にゅうしゅつりょくInputoutput; IO協調きょうちょうしてプログラムを実行じっこうする過程かてい説明せつめいする。命令めいれい実行じっこう、データの保持ほじ外部装置がいぶそうちとのデータ交換こうかん区別くべつすることにより、プログラムのいと計算機けいさんき構成こうせい対応たいおうづける。

2格納かくのうプログラム方式ほうしき

格納かくのうプログラム方式ほうしきStored-program architectureでは、プログラムを構成こうせいする命令めいれいと、その命令めいれい処理しょりするデータを、いずれも主記憶しゅきおく配置はいちする。CPUは主記憶しゅきおくからつぎ実行じっこうする命令めいれい取得しゅとくし、その命令めいれい指定していする演算えんざん実行じっこうする。

主記憶しゅきおく番地ばんちAddressによって識別しきべつされる記憶場所きおくばしょ集合しゅうごうとしてあつかえる。プログラムの変数へんすうは、実行時じっこうじにはあたい格納かくのうする記憶場所きおくばしょまたはその場所ばしょ参照さんしょうする仕組しくみに対応たいおうする。ただし、コンパイラによる最適化さいてきかでは、あたいがCPU内部ないぶのレジスタだけに保持ほじされることもあるため、すべての変数へんすうつね主記憶しゅきおく固定番地こていばんち占有せんゆうするわけではない。

3CPUと命令めいれいサイクル

CPUは、演算えんざん実行じっこうする演算装置えんざんそうちArithmetic and logic unit; ALU命令実行めいれいじっこう制御せいぎょする制御装置せいぎょそうちControl unit少量しょうりょうのデータを高速こうそく保持ほじするレジスタRegisterなどから構成こうせいされる。

命令めいれい処理しょりは、概念的がいねんてきにはつぎ命令めいれいサイクルInstruction cycleとして整理せいりできる。

  1. Fetch: つぎ実行じっこうする命令めいれい主記憶しゅきおくから取得しゅとくする。
  2. 解読かいどくDecode: 命令めいれい要求ようきゅうする演算えんざん対象たいしょう判定はんていする。
  3. 実行じっこうExecute: 演算えんざん、データ転送てんそう、または分岐ぶんき実行じっこうする。
  4. もどWrite-back: 必要ひつようおうじて結果けっかをレジスタまたは主記憶しゅきおく保存ほぞんする。

たとえば、ふたつのあたいをレジスタへんだあと加算かさんする処理しょりでは、加算命令かさんめいれいがALUに演算えんざん指示しじし、結果けっかをレジスタへ保存ほぞんする。どの命令めいれいがメモリを直接ちょくせつ参照さんしょうできるかは、命令めいれいセットによってことなる。条件分岐じょうけんぶんきは、条件じょうけんおうじてつぎ取得しゅとくする命令めいれい番地ばんち変更へんこうする。

4記憶階層きおくかいそう

記憶装置きおくそうち容量ようりょう速度そくど単位容量たんいようりょうあたりの費用ひようあいだにはトレードオフがある。このため、計算機けいさんき一般いっぱんに、レジスタ、キャッシュ、主記憶しゅきおく補助記憶ほじょきおくという記憶階層きおくかいそうMemory hierarchy構成こうせいする。

レジスタキャッシュ主記憶補助記憶

左側ひだりがわほどCPUにちかく、高速こうそくかつ小容量しょうようりょうである。プログラムによるメモリ参照さんしょうには、みじか時間じかん同一どういつ記憶場所きおくばしょまたはその近傍きんぼう参照さんしょう集中しゅうちゅうする傾向けいこうがある。この傾向けいこう参照さんしょう局所性きょくしょせいLocality of referenceという。記憶階層きおくかいそうは、この局所性きょくしょせい利用りようして、頻繁ひんぱん参照さんしょうするデータをCPUにちか階層かいそう再利用さいりようする。

5入出力にゅうしゅつりょく

入出力にゅうしゅつりょくは、ディスプレイ、キーボード、補助記憶装置ほじょきおくそうち、ネットワークインタフェースなどとデータを交換こうかんする機能きのうである。CPUと入出力装置にゅうしゅつりょくそうちには動作速度どうさそくどがあるため、CPUが完了かんりょう待機たいきつづける方式ほうしきだけではCPU時間じかん有効ゆうこう利用りようできない。割込わりこみは装置そうち状態変化じょうたいへんか処理完了しょりかんりょうをCPUへ通知つうちする。DMADirect Memory Accessは、CPUがデータを一語いちごずつ転送てんそうすることなく、装置そうち主記憶しゅきおくあいだでデータを転送てんそうする。これらは、CPUと入出力にゅうしゅつりょく並行動作へいこうどうさ支援しえんする代表的だいひょうてき仕組しくみである。

ネットワーク通信つうしん入出力にゅうしゅつりょく一種いっしゅである。後続こうぞくのネットワーク講義こうぎでは、データを複数ふくすう計算機けいさんきあいだ転送てんそうする仕組しくみを詳述しょうじゅつする。

6性能せいのう区別くべつして評価ひょうかする

プログラムの所要時間しょようじかん分析ぶんせきするときは、すくなくともつぎ要因よういん区別くべつする。

  • CPUが命令めいれい実行じっこうする時間じかん
  • 記憶階層きおくかいそうからデータを取得しゅとくする時間じかん
  • 入出力にゅうしゅつりょく完了かんりょう時間じかん

アルゴリズムの計算量けいさんりょうは、入力規模にゅうりょくきぼたいして必要ひつよう演算回数えんざんかいすう記憶量きおくりょうがどのように増加ぞうかするかを抽象的ちゅうしょうてきあらわす。実測時間じっそくじかんは、それにくわえてCPU、記憶階層きおくかいそう入出力装置にゅうしゅつりょくそうち実装じっそうなどの影響えいきょうける。したがって、計算量けいさんりょう特定とくてい計算機けいさんきにおける実測時間じっそくじかん同一どういつではない。

7要点ようてん

  • 格納かくのうプログラム方式ほうしきでは、命令めいれいとデータを主記憶しゅきおく配置はいちし、CPUが命令めいれいサイクルにしたがって処理しょりする。
  • 記憶階層きおくかいそうは、速度そくど容量ようりょう費用ひよう相違そうい利用りようしてデータ参照さんしょう効率化こうりつかする。
  • 実行時間じっこうじかん分析ぶんせきでは、CPU処理しょり、メモリ参照さんしょう入出力待機にゅうしゅつりょくたいき区別くべつする。

8つぎすす講義こうぎ

data/lecture/information/networks/computer-networks-portal.lecture.n.md

Computer Systems Fundamentals

data/lecture/information/systems/computer-systems-portal.lecture.n.md

1Introduction

This lecture explains how the CPUCentral Processing Unit, main memoryMain memory, and inputoutputInputoutput; IO cooperate to execute a program. By distinguishing instruction execution, data storage, and exchange with external devices, it connects program behavior to computer organization.

2Stored-Program Architecture

In a stored-program architectureStored-program architecture, both the instructions that constitute a program and the data processed by those instructions reside in main memory. The CPU retrieves instructions from main memory and performs the operations that they specify.

Main memory can be treated as a collection of storage locations identified by addressesAddress. At run time, a program variable corresponds to a location that stores a value or to a mechanism for referring to that location. Compiler optimizations may keep a value solely in a CPU register, so not every variable permanently occupies a fixed address in main memory.

3The CPU and the Instruction Cycle

A CPU includes an arithmetic and logic unitArithmetic and logic unit; ALU that performs operations, a control unitControl unit that directs instruction execution, and registersRegister that provide a small amount of high-speed storage.

Instruction processing can be organized conceptually as the following instruction cycleInstruction cycle.

  1. FetchFetch: Retrieve the next instruction from main memory.
  2. DecodeDecode: Determine the operation and operands specified by the instruction.
  3. ExecuteExecute: Perform an operation, data transfer, or branch.
  4. Write-backWrite-back: Store the result in a register or main memory when required.

For example, in a computation that loads two values into registers and then adds them, an addition instruction directs the ALU to perform the operation and stores the result in a register. Whether an instruction can refer to memory directly depends on the instruction set. A conditional branch changes the address of the next instruction according to a condition.

4Memory Hierarchy

Storage technologies involve tradeoffs among capacity, speed, and cost per unit of capacity. Computers therefore generally organize storage as a memory hierarchyMemory hierarchy consisting of registers, caches, main memory, and secondary storage.

registerscachesmainmemorysecondarystorage

Components farther to the left are closer to the CPU, faster, and smaller. A program tends to concentrate its memory references on the same storage locations or nearby locations over a short period. This tendency is called locality of referenceLocality of reference. A memory hierarchy exploits locality by reusing frequently accessed data at levels close to the CPU.

5Input/Output

Input/output exchanges data with displays, keyboards, secondary storage devices, network interfaces, and other devices. Because CPUs and I/O devices operate at different speeds, a design in which the CPU merely waits for each operation to finish cannot use CPU time efficiently. An interrupt notifies the CPU of a device state change or operation completion. DMADirect Memory Access transfers data between a device and main memory without requiring the CPU to move each word. These mechanisms help CPU execution and input/output proceed concurrently.

Network communication is also a form of input/output. The following network lectures explain how data is transferred among multiple computers.

6Distinguishing Sources of Performance

An analysis of program execution time should distinguish at least the following factors:

  • time spent executing instructions on the CPU;
  • time spent obtaining data from the memory hierarchy; and
  • time spent waiting for input/output to complete.

Algorithmic complexity abstracts how the required number of operations or amount of storage grows with input size. Measured execution time additionally depends on the CPU, memory hierarchy, I/O devices, implementation, and other factors. Algorithmic complexity and measured time on a particular computer are therefore not identical.

7Key Points

  • In a stored-program architecture, instructions and data reside in main memory, and the CPU processes instructions through an instruction cycle.
  • A memory hierarchy exploits differences in speed, capacity, and cost to make data access efficient.
  • Performance analysis distinguishes CPU processing, memory access, and input/output waiting time.

8Next Lecture

data/lecture/information/networks/computer-networks-portal.lecture.n.md
raw .n.md をコピー
loc をコピー (filepath:line ~ line)
copy share link
copy encoded share link
path をコピー
copy share link
copy encoded share link
copy share link
copy encoded share link
タブを全て閉じる