[Lecture Summary] Operating System from Scratch - 01

Hyojin·2022년 12월 29일

A computer sustem is a combination of hardware, software, and data which are used to solve the problem of human being.
Hardware consists of...
1) CPU
2) Memory (RAM, Hard disk, Cashe, Resgisters)

CPU will take the program stored inside RAM line by line and execute it.
Q. Why are we using these many levels of memory? Every memory system has its own advantages/disadvantages. (Hard disk is permanent and RAM is fast in access time.)
Q. To take both advantage? Copy the data (in the HD) and paste it into the RAM.

Any program you take in your computer, it will definitely present in the hard disk. However, the high level program cannot be directly placed inside the hard disk. (e.g. Java, C++) Because CPU can only understand 0's and 1's, which are binary numbers.

Compiler compiles the source code. Compiler is also a program/software which will convert a high level program into the machine code. And machine code is also called as '.exe code' or executable code or low level program)

Once machine code is converted this into the machine code, it is placed into the HD of the computer.

Below is the simple diagram showing CPU and memory.

Once thing to note is that HD has large memory than RAM and is much cheaper than RAM.
CPU cannot access HD directly but CPU can only access the RAM directly.
Let's say CPU is requesting programming named P1.
1. Operating System will search for the program P1 inside the RAM.
2-1. If p1 is present in the RAM -> Fine!
P1 will be fetched into the CPU and then executed.
2-2. If p1 is not present in the RAM
P1 will be copied and place in the RAM.
Once P1 is moved into the RAM, CPU will take the P1 from the RAM.
In this case, CPU is accessing both RAM and HD.
-> It takes a lot of time. In addition, HD is very slow.

Q. Out of 500 program in HD, which 50 programs are you going to move to RAM? You might want to move what is most likely(prediction) to be requested by the CPU next.
This is predicted by the algorithm, which is implemented by OS.
[1] We say this functionality(selection of proccessess from HD to RAM) as 'Long term scheduler'.
OS is implementing resource allocation, acting as a resource manager.
[2] This function determines, out of these [3] two programs(p1, p2), which program should access the resource(CPU).
This functionality is called as 'Short term scheduler'.
Here also resource(resource is CPU in this case) is happening. Why? More than one process is trying to access the CPU and the OS is actually allocating the resource.

The main point of today's lecture

The main function of operating system is resource allocation (resource managemnet).

profile
Just to record everyday's learning

0개의 댓글