Operating System Course1-2 half

hello?

Screen output "hello"?

The computer sends some instructions through the CPU to the CPU memory through the CPU memory bus, and the CPU memory sends the ASCII code corresponding to h, and writes a certain video memory address through the bus controller and PCI bus to the graphics controller, which can be used for display. And so on to output hello.

And why can we use printf("hello") to output hello?

Because of the operating system, the operating system (Linux, Windows, etc.) is between the application software (word, MATLAB, etc.) and the computer hardware (CPU, memory, video memory, etc.). The operating system is a layer of software that is equivalent to the computer hardware package , allowing application software to be better and more conveniently controlled. In simple terms, it is a layer of software between computer hardware and applications.

application

operating system

Computer hardware

Partial role: It is convenient to use memory and use hardware efficiently (such as opening multiple terminal windows).

Hardware managed by the operating system: CPU, memory, terminal, disk, file, network, power supply, multi-core.

The learning of the operating system needs to switch between the principle and the code in real time in order to gradually understand this "black box".

At the beginning

Computer Beginning: Blank paper to Turing machine (the idea is borrowed from this person => pen => paper, and a digital paper tape and controller are used to realize a calculation model)

The paper tape is equivalent to the recipe, and the controller is equivalent to the chef.

Obviously this controller is equivalent to the current CPU, and the paper tape is equivalent to the application program to be loaded.

Processing: First, the program is put into the memory, and then a pointer is used to point to it, and then the address is automatically fetched and executed, and the computer starts to work. ("fetch and execute")

The controller is equivalent to a "read-write head" with many components, which can read characters in any grid on the paper tape, and can also write characters into the grid of the paper tape, including components such as storage units (used to store data), Control unit (recognizes whether characters are data or instructions) and arithmetic unit (executes arithmetic instructions).

For example, execute 1+1, pass in the order of 11+ on the paper tape (just an example, it refers to the string, there is no such simple transmission in reality), then there is a control unit to identify, store two 1s in the storage unit, read to the operation After the symbol +, it is then calculated by the arithmetic unit.

From Turing machine to computer, it is based on von Neumann's storage program idea , which stores programs and data in the internal memory of the computer, and the computer processes it step by step under the control of the program.

The five major components of a computer are: input devices, output devices, memory, computing units, and controllers.

When the power is turned on, what is the first instruction executed?

Determined by the hardware designer, the pointer IP will be addressed to the ROM BLOS mapping area (the only place where there is code at the beginning), and only if there is code can the instruction be fetched and executed, otherwise it will be blank and the operating system cannot be executed.

【BLOS Base Input Output System】

Take x86 PC as an example

  1. The CPU is in real mode just after starting up (addressing is CS:IP, CS shifts 4 bits to the left + IP)

  1. When booting, CS=0xFFFF;IP=0x0000

  1. Address 0xFFFF0 (ROM BLOS mapping area)

  1. Check RAM, keyboard, monitor, soft and hard disk (if this step is broken, it means that the computer hardware is broken)

  1. Read disk 0 track 0 sector into position 0x7c00 (the code stored in 0x7c00 is 512 bytes read from the disk boot sector)

  1. set cs=0x07c0, ip=0x0000

The boot sector is the first sector of the boot device . The boot device information is set in CMOS (a semiconductor that stores real-time clock and hardware configuration information). Therefore, the first sector of the hard disk is stored in the first section of the program that we can control after booting.

The story of the operating system starts here!

Learning reference:

https://www.xiaolincoding.com/

[Harbin Institute of Technology] Operating System Li Zhijun

Guess you like

Origin blog.csdn.net/lxd_max/article/details/128832317