Kaigai Blog living abroad in my twenties

【Lecture8】Computer Systems & Networks

Hardware Infotech

How to Write minus in binary


More about this

Bootstrapping

  • Execution begins with bootstrap loader stored in BIOS/ROM.
  • Looks for OS program in a fixed location
  • Loads OS into RAM

More about this

The Kernel

  • At start up the OS Kernel is loaded into RAM by a program called a bootstrap loader and runs continually while the computer is powered up.
  • It contains essential services required by other parts of the operating system and applications.

What Kernel does

  • CPU Management (scheduling, interrupt handling)
  • Process Management (Multithreading, IPC, Synchronisation)
  • Memory Management (Allocation, Swapping etc)
  • User Management (Access control, logins, security etc)
  • IO Device Management (Access Control, etc)
  • File System Management / Secondary Storage

CPU Management

What is Scheduling (Explanation1)

Scheduling of processes/work is done to finish the work on time. CPU Scheduling is a process that allows one process to use the CPU while another process is delayed (in standby) due to unavailability of any resources such as I / O etc, thus making full use of the CPU. The purpose of CPU Scheduling is to make the system more efficient, faster, and fairer.

What is Scheduling (Explanation2)

The task of deciding which process to run next during multitasking is called scheduling.

  • First-come first served: The scheduler dispatches the ready process that has been waiting the longest.
  • Explicit priority: Each process can be assigned a priority level. The scheduler dispatches the ready process that has the highest assigned priority level.
  • Shortest Remaining Time: The next process to be dispatched is based on the expected amount of CPU time needed to complete the process.

You can change the priority of each applications

Process Management

What is multithreading?

Recommended Article to understand this concept (Japanese)

感覚的には、CPU managementがスレッドの塊である沢山のプロセスを管理していて、Process Managementがそのスレッドをそれぞれ管理しているイメージなのかもしれない。
  • A process is a unit of executing software that is managed independently by the operating system
  • A process can request and receive hardware resources and operating system services -> DLL

DLL (Dynamic Link Library)

Windowsのプログラムファイルの種類の一つで、様々なプログラムから利用される汎用性の高い機能を収録した、部品化されたプログラムのこと。多くのプログラムが共通して必要とする機能が収められており、様々なプログラムの一部として取り込まれて実行されている。

PCB

In more advanced OS the process context is defined by more than just the CPU registers so a special data structure is used called the PCB. The Process Control Block (PCB) is created when a process is created, updated when the process changes and deleted when it terminates. It contains:

  • A unique process identification number
  • The current state of the process
  • Events for which the process is waiting
  • Resources allocated exclusively to the process
  • Machine resources consumed
  • Process ownership and/or access privileges
  • Scheduling priority

Memory Management

  • Our kernel optimizes memory usage and makes sure our applications have enough memory to run.
  • Manage allocation and freeing of memory used by running processes
  • Used to protect one process from being corrupted by another process.

CPU Sharing during I/O Breaks

Running State, Blocked State, Ready Stateの3つをそれぞれのプログラムで繰り返し行うことで、I/Oからの返答を待つ時間の間に他のプログラムを実行するみたいなことができ、効率よくCPUをフル活用させることが出来る。

Time-sharing the CPU

Context Switching

Virtual Memory

これは、Memoryの容量がいっぱいになった時に、HDDの中にVirtual Memoryを作ることによって、Memoryの使用量を増やすことが目的。これをすることにより、そこまで使用頻度の高くないものをVirtual Memoryに一時的に保管することが出来る。(使用するときに、Memoryに移す)