In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Starting today, we're going to write a tiny operating system (based on the x86 architecture). Of course, it was also to learn from others, just to make a summary. Write it down, learn it with everyone, and review it later.
So what is an operating system? Our common operating systems are: Windows, Unix, Linux, Mac OS, Android and iOS. Simply put, an operating system is a computer program that runs directly on top of hardware. One of its roles is to manage and control computer hardware and software resources; another important role is to provide the necessary services and interfaces for user software development. Let's take a look at the architecture of modern computer systems, as shown below.
We see that at the top is the application layer, which is what we usually call the software development layer. Software development is divided into two types: user software development and compiler software development. Then there is the operating system, which provides the environment for software to run and various services and interfaces. Further down is BIOS, for this word, we have installed computer systems know, will be detailed analysis later. At the bottom is the hardware layer, which provides the hardware environment necessary for the operating system.
The BIOS is called Basic Input & Output System. BIOS is also essentially a program, which is the first program to run after the computer is powered on. The work it does is mainly divided into the following: a> first detect the hardware state, and immediately initialize the hardware after the detection;b> it will establish an interrupt vector table in memory, which is used to provide a method for hardware access;c> Finally, the control right is handed over to the main boot program to enter the operating system. Note: BIOS is not software, but firmware! So what is firmware? Firmware is a program that is fixed in hardware and has been written and fixed before the hardware leaves the factory.
Let's take a look at the system startup process of x86 architecture, as shown in the following figure.
We see first the system hardware power-on, then run BIOS, initialize hardware; then build interrupt vector table, load and run main boot program; software initialization, load and run operating system kernel, and finally system initialization. How does BIOS work? Let's take a look at how BIOS works. BIOS is stored in ROM with address mapping 0xF0000 - 0xFFFF (physical address), and its entry address is 0xFFFF0. Then, under the special design of the hardware circuit, the CPU will start executing from 0xFFFF0 after the system is booted. BIOS scans all storage media (CD-ROM, floppy drive, USB flash drive, etc.) according to user settings. After discovering the main boot area, BIOS loads the main cause program in the main boot area into memory; the entry address of the main cause program in memory is 0x7c00, and finally the control right is handed over to the main boot program. How do I hand it over? It is a command: jmp 0x7c00.
So how does BIOS find the main boot area in storage media? And how do you determine if there is a master boot program in the boot zone? Next, let's first introduce the main boot area, which is abbreviated as MBR, i.e. Master Boot Record. The MBR is located at the very beginning of the storage medium and is 512 bytes in size; it is characterized by the fact that the last 2 significant bytes of the first 512 bytes are 0x55aa; its data is 0x55aa and data up to that is considered the master boot program. Is the first 512 bytes an MBR? Not necessarily! If it is judged that it is the main boot area, and then the main boot program is loaded into memory, when it runs, it may be found that it is illegal, and then the execution error. Therefore, the program stored in the main boot area is not necessarily a legally usable program. So how do you determine if it's legally available? We'll talk about it in the next blog section.
Let's take a look at the more detailed system startup process, as shown in the following figure.
After running BIOS, scan the storage medium first, if there is MBR in the storage medium, then start loading the main boot program, address 0x7c00; then transfer the control right to the main boot program to execute, initialize the software, and finally load the operating system kernel to initialize the system. So through today's study of the basic knowledge of the operating system, summarized as follows: 1, BIOS is the first program to run after the computer is powered on;2, BIOS performs the necessary initialization, and loads and runs the main boot program;3, the main boot program is located at the beginning of the storage medium 512 bytes;4, the main boot program is responsible for the subsequent initialization, and loads and runs the operating system kernel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.