OS resource management and processes
導入済み
13:59
リソース、コンパイラ & RPN
ブラウザ、音楽プレイヤー、ゲームを開きます。プロセッサは1つ(コアが数個あるかもしれません)ですが、すべてが同時に動いているように見えます。そしてこれらはすべて…もっと必要なことを求めています。
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| mouse pointer | A symbol on the screen that shows where the mouse is pointing. |
| operating system/ˈɒpəreɪtɪŋ ˈsɪstəm/ | System software that manages hardware resources and provides services for applications. |
| process/ˈprəʊses/ | プロセス |
| scheduler/ˈʃedjʊlə/ | スケジューラ |
| processor/ˈprəʊsesə/ | The component that executes instructions and performs the operations of a computer or similar system. |
| memory/ˈmeməri/ | The part of a computer that holds data and programs currently in use. |
| queue/kjuː/ | A data structure in which items are normally removed in the order they were added. |
| Multi-tasking/ˈmʌlti ˈtæskɪŋ/ | The processor is switched rapidly between processes, so several appear to run at once even though only one is executing at any instant. |
| Paging/ˈpeɪdʒɪŋ/ | Memory is moved between RAM and disk so more programs can be open than physical memory allows. |
| RAM/ræm/ | Random-access memory used for working data and instructions, usually losing its contents when power is removed. |
| disk/dɪsk/ | A storage device that holds programs and data even when power is off. |
| physical memory | The actual memory hardware that holds data and programs currently in use. |
| Spooling/ˈspuːlɪŋ/ | Output for a slow device is queued on disk, so the processor never waits for a printer. Caching keeps recently used data in fast memory so it need not be fetched again. |
| Caching/ˈkæʃɪŋ/ | The process of keeping recently used data in fast memory for quicker access. |
| user interface/ˈjuːzə ˈɪntəfeɪs/ | The controls, displays and interaction mechanisms through which a person communicates with a computer system or program. |
| command line | A place where users type text commands to interact with a computer. |
| GUI | A user interface that lets people interact using visual elements. |
| ready/ˈredi/ | Describes a process that can run and is waiting for the processor. |
| Round robin/raʊnd ˈrɒbɪn/ | A scheduling method that gives each ready process a fixed time slice in turn. |
| time slice/taɪm slaɪs/ | A short interval of processor time allocated to a task before another task may run. |
| first come first served | A scheduling method that runs processes in the order they become ready. |
| shortest job first | A scheduling method that selects the ready process with the shortest expected running time. |
| shortest remaining time | A scheduling method that selects the process with the least expected time left to run. |
| New | Being created. Ready: able to run, waiting only for the processor. Running: currently executing. Blocked : waiting for something else, usually input or output. Terminated : finished. |
| Blocked/blɒkt/ | Describes a process that cannot continue until an event occurs. |
| Terminated | Describes a process that has finished running or has been stopped. |
| I/O | The transfer of data into or out of a computer or process. |
| ready queue | A list of processes waiting for the processor so they can run. |
| context switch/ˈkɒntekst swɪtʃ/ | コンテキストスイッチ |
| registers/ˈredʒɪstəz/ | A small, fast storage location within a processor used to hold data, addresses or instructions temporarily. |
| program counter/ˈprəʊɡræm ˈkaʊntə/ | A register that holds the address of the next instruction to be fetched. |
| process control block/ˈprəʊses kənˈtrəʊl blɒk/ | プロセス制御ブロック |
| interrupts/ˈɪntərʌpts/ | Signals or events that cause normal processor execution to be suspended while service routines handle them. |
| kernel/ˈkɜːnl/ | The central part of an operating system that manages resources and provides core services to programs. |
| core/kɔː/ | The central or most important part of a system or region. |
| timer interrupt | A signal from a timer that returns control to the operating system. |
| pre-emptive scheduling | A method where the operating system can stop a running process and give another process time on the processor. |
なぜ全てが凍結してもマウスは動くのか
- プログラムがロックアップします。ウィンドウは再描画されず、スピナーは止まり、何も応答しません。しかし、マウスカーソルはまだ以前と同じように画面を滑っています。
- これはオペレーティングシステムが何かを教えてくれています:マシンが停止しているわけではなく、ある プロセス が停止しているだけです。スケジューラは依然としてプロセッサのスライスを割り当てており、凍結したプログラムはそのスライスを使って何も有用なことをしていないだけなのです。
- マシンのあらゆるリソース就是这样共有されています:プロセッサは時間で、メモリは空間で、プリンタはキューで。
- この授業では、OSがこれらのリソースを最大限に活用する方法と、プロセスの生成から終了までの管理方法を解説します。

リソースを最大限に活用する
- マルチタスク: プロセッサはプロセス間で高速に切り替わるため、一度に実行されているのは1つだけですが、複数のプロセスが同時に動作しているように見えます。
- ページング: メモリをRAMとディスク間で移動させることで、物理メモリより多くのプログラムを同時に開くことができます。
- スプーリング: 低速デバイスの出力をディスク上のキューに格納するため、プロセッサはプリンターの処理を待つ必要がありません。キャッシュは最近使用されたデータを高速メモリに保持し、再度取得する必要をなくします。
- OSはこのすべての処理を、コマンドラインまたはGUIであるユーザーインターフェースの背後に隠しています。

Multi-tasking lets several programs appear to run at once by:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The OS rapidly switches the single CPU between processes so they all seem to progress together.
計算例: スプーリングが有用な理由
- スプーリングがコンピュータのリソース利用をどのように改善するか説明しなさい。 [3]
- プリンターはプロセッサより数千倍遅いため、出力を直接送るプログラムは待たされ、プロセッサはアイドル状態になります。
- スプーリングを使用すれば、出力はディスク上のキューに素早く書き込まれ、プログラムは即座に次の処理に進みます。
- 別プロセスがプリンターを独自の速度で処理するため、プロセッサが他の作業を行う間に、複数のジョブをキューに積むことができます。低速デバイス、キュー、そしてプロセッサが代わりに行う作業の名前を述べよ。

Spooling helps the system because:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Spooling buffers print jobs to disk so the fast CPU is not held up by the slow printer.
Which techniques help an OS get the most from its resources? Select すべて that apply.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Sharing time, queueing for slow devices and keeping hot data close. Killing waiting processes would lose the user's work, not improve utilisation.
プロセスとスケジューラ
- プロセスとは実行中のプログラムであり、そのコード、現在の状態、メモリ、開いているファイルを含みます。ディスク上のプログラムはプロセスではなく、実行中のプログラムがプロセスです。
- スケジューラは、次にどの準備完了プロセスを実行するか、またどの程度実行させるかを決定します。その目標は、プロセッサを忙しく保つこと、インタラクティブなユーザーに素早く応答すること、公平であることです。
- ラウンドロビンは各準備完了プロセスに一定のタイムスライスを与え、その後キューの最後へ送ります: 単純で、公平かつ応答性が高いです。他のポリシーには先来者順 (FCFS)、最短作业优先 (SJF)、剩余時間最短があります。

誰にも欠けがなく、誰もプロセッサを独占しません

Round-robin scheduling gives each ready process a fixed time slice, then moves it to the back of the queue — making it fair and responsive.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Equal time slices in turn stop any one process hogging the CPU, so interactive programs stay responsive.
What is a process?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The file on disk is a program; once it is loaded and running, with state of its own, it is a process.
プロセスの状態
- New: 作成中。Ready: 実行可能で、プロセッサのみを待機中。Running: 現在実行中。Blocked: 入出力などの外部イベントを待機中。Terminated: 終了済み。
- 状態遷移は試験で問われる内容です。タイムスライスの満了によりRunningがReadyへ移行。I/O要求によりRunningがBlockedへ移行。I/O完了によりBlockedがReadyへ移行。スケジューラによって選択されることでReadyがRunningへ移行します。
- 非対称性に注意してください: Blocked状态のプロセスが直接Runningに戻ることはありません。Readyキューに戻り、順番を待ちます。

5つの状態と、それぞれの矢印の理由

Match each process state to what it means.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
A process cycles ready → running → (blocked) → ready, until it terminates.
計算例: プロセスのトレース
- あるプロセスがファイルの読み込みを要求した瞬間、それが実行されていました。このプロセスに何が起こるか説明しなさい。
- データ到着まで続行できないため、RunningからBlockedへ移行します。スケジューラは待たず、直ちに別の準備完了プロセスにプロセッサを割り当てます。
- ディスクの読み込みが完了すると、プロセスはBlockedからReadyへ移行します。すぐに実行を再開するわけではなく、準備完了キューに加わります。
- 後でスケジューラによって選択され、ReadyからRunningへ移行して、中断していた地点からそのまま実行を続けます。
The life of a process
Tap round the loop a process travels. It only runs when the scheduler picks it; needing I/O sends it to blocked, and finishing its time slice sends it back to ready — round and round until it's done.
A running process asks to read a file. Put what happens to it in order.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
A blocked process never returns straight to running: it rejoins the ready queue and waits its turn.
コンテキストスイッチ
- 実行中のプロセスを変更するために、OSは現在のプロセスの状態、レジスタ、プログラムカウンタ、ステータスをプロセス制御ブロック (PCB) に保存し、次に実行するプロセスの状態をそのプロセス固有のブロックからロードします。
- これをコンテキストスイッチと呼びます。これには現実的なコストがかかります: コントロールスイッチ中、プロセッサはユーザーの作業を行わず、家務(管理作業)を行 onlyします。
- そのため、タイムスライスはトレードオフです。長すぎるとインタラクティブなプログラムが重く感じられ、短すぎると機械が計算よりも切り替えに時間を割いてしまいます。

A context switch involves:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The OS saves the running process's registers/PC to its PCB and loads the next process's — a small overhead each switch.
During a context switch, a process's registers and program counter are saved into its ____.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The next process's state is then loaded from its own block. The saving and loading is real work, which is what makes switching cost time.
インターラプトとカーネル
- カーネルはOSのコアであり、実際にこれを遂行します。デバイスやプログラムからのインターラプトに応答し、インターラプトとは実行中のプロセスからOSへのコントロールの返却のことです。
- タイムスライスの終了時に発生するタイマー割り込みこそが、事前占有スケジューリングを可能にする根本的な要因である。これがない場合、イールド never するプログラムはプロセッサを永遠に占有してしまう。
- これが冒頭のクイズの答えです: フリーズしたプログラムは自分のタイムスライス以上のプロセッサを占有していないため、マウスは動き続けます。
見落としやすいポイント
- プロセスは実行中のプログラムであり、ディスク上のファイルではありません。
- BlockedからReadyへ、直接Runningへはなりません。スケジューラが次に実行するタイミングを選びます。
- コンテキストスイッチはプロセス制御ブロックを通じて状態を保存・復元しますが、これにはコストがかかります。
- マルチタスクとは、プロセスが非常に速い順番で交代するため同時に実行しているように見えることであり、単一コア上で真に一度に実行されていることを意味しません。
理解できましたか
- OSはマルチタスク、ページング、ディスクキューへのスプーリング、キャッシュによってリソース利用を最大化します。
- プロセスは実行中のプログラムであり、スケジューラは次の準備完了プロセスを選択し、ラウンドロビンは各プロセスに一定のタイムスライスを与えます。
- 状態はNew, Ready, Running, Blocked, Terminatedです: タイムスライスの満了はRunningをReadyへ、I/O要求はRunningをBlockedへ、I/O完了はReadyへ戻します。
- コンテキストスイッチはプロセス制御ブロックを介して状態を保存・復元し、コストがかかるため、スライスの長さはトレードオフとなります。
何が問題でしたか?この内容はサイトの運営チームだけが確認します。