Operating system --- learning notes 0, operating system --- learning notes
Note: This document follows the "Netease cloud classroom"-Harbin Institute of Technology-instructor Li Zhijun's Open Class course. I would like to thank Mr. Li for his busy schedule to provide excellent teaching resources for the majority of students.
Introduction to main platforms and tools: x86 simulator Bochs
Bochs is a free and open source IA-32 (x86) architecture PC simulator. Linux, DOS, Windows, and other operating systems can be run in the simulated environment. Bochs itself is highly portable and can run on a variety of software and hardware platforms, which is also the main reason we choose it as the designated simulator in this book. If you want to embrace free Linux, Bochs is your best choice. If you want to continue binding yourself to Windows, you can choose VMware or Microsoft Virtual PC in addition to Bochs. They are the most famous Virtual Machine Software and are available for free. Because Bochs is a simulator, its principle determines that its operation efficiency is lower than that of virtual machines. However, for the experiments designed in this book, the efficiency difference is not obvious. Moreover, Bochs has unparalleled ability to debug operating systems for virtual machines, so we recommend that you use Bochs. Hit-oslab has built-in bochs. This experiment assumes that the default environment is Bochs.
For more details about Bochs, visit its home page and Bochs user manual.
GCC compiler
GCC is a compiler that has grown up with Linux. The initial version of Linux was compiled by GCC. GCC is also the most widely used compiler in the field of free software. Therefore, we also choose GCC as the designated compiler for this book's experiment.
DB Debugger
The GDB debugger is a member of the GCC compiler. As almost the only Debugger in the field of free software, it adopts the consistent style of * nix operating systems and uses command line operations, a bit similar to debug under dos. For how to use it, see the GDB user manual.
Ubuntu (GNU/Linux)
Ubuntu may not be the most popular Linux Desktop release, but it must be the most popular. The main feature is ease of use and ease of use.
Now, more and more people are beginning to replace Windows with Ubuntu, and enjoy the feeling of being more free, secure, and law-abiding. Ubuntu home page is http://www.ubuntu.com/, here not only can download to the iso file for free, even can apply for Ubuntu installation disc for free.
We strongly recommend that you perform experiments in Ubuntu. Some experiments involve running self-compiled applications in Linux 0.11. The improved functions are already available in the Linux kernel of a higher version. After confirming that the applications you have compiled are correct, you can use the improved Linux 0.11 to test the improved functions.
Common commands in Linux:
Decompression: tar zxvf hit-oslab-linux-20110823.tar.gz
Compile: make all "all" is the most common parameter, so it can be omitted
On a multi-processor system, you can use the-j parameter for parallel compilation to speed up. For example, a dual-CPU system can:
$ Make-j 2
Linux-0.11 directory is all the source code, many experimental content is to be done by modifying the code. After the modification, you need to re-compile the kernel, or execute the command:
$ Make all
The make command automatically skips unmodified files and directly uses the target file generated in the previous compilation to save Compilation Time. However, if your modification does not take effect after recompilation, you can try "make clean" first and then "make all ". "Make clean" is to delete all the intermediate and target files generated by the last compilation, ensuring that the entire project is compiled in a completely new state.