os01 README

The project's README from github.com/tuhdo/os01. As one markdown file: README.md.

Donate

Operating Systems: From 0 to 1

This book helps you gain the foundational knowledge required to write an operating system from scratch. Hence the title, 0 to 1.

After completing this book, at the very least you will learn:

Download the book

The pedagogy of the book

You give a poor man a fish and you feed him for a day. You teach him to fish and you give him an occupation that will feed him for a lifetime.

This has been the guiding principle of the book when I was writing it. The book does not try to teach you everything, but enough to enable you to learn by yourself. The book itself, at this point, is quite "complete": once you master part 1 and part 2 (which consist of 8 chapters), you can drop the book and learn by yourself. At this point, smart readers should be able to continue on their own. For example, they can continue their journeys on OSDev wiki; in fact, after you study everything in part 1 and part 2, you only meet the minimum requirement by OSDev Wiki (well, not quite, the book actually goes deeper for the suggested topics). Or, if you consider developing an OS for fun is impractical, you can continue with a Linux-specific book, such as this free book Linux Insides, or other popular Linux kernel books. The book tries hard to provide you a strong foundation, and that's why part 1 and part 2 were released first.

The book teaches you core concepts, such as x86 Assembly, ELF, linking and debugging on bare metal, etc., but more importantly, where such information come from. For example, instead of just teaching x86 Assembly, it also teaches how to use reference manuals from Intel. Learning to read the official manuals is important because only the hardware manufacturers themselves understand how their hardware work. If you only learn from the secondary resources because it is easier, you will never gain a complete understanding of the hardware you are programming for. Have you ever read a book on Assembly, and wondered where all the information came from? How does the author know everything he says is correct? And how one seems to magically know so much about hardware programming? This book gives pointers to such questions.

As an example, you should skim through chapter 4, "x86 Assembly and C", to see how it makes use of the Intel manual, Volume 2. And in the process, it guides you how to use the official manuals.

Part 3 is planned as a series of specifications that a reader will implement to complete each operating system component. It does not contain code aside from a few examples. Part 3 is just there to shorten the reader's time when reading the official manuals by giving hints where to read, explaining difficult concepts and how to use the manuals to debug. In short, the implementation is up to the reader to work on his or her own; the chapters are just like university assignments.

Prerequisites

Know some circuit concepts:

However, if you know absolutely nothing about electricity, you can quickly learn it here: http://www.allaboutcircuits.com/textbook/, by reading chapter 1 and chapter 2.

C programming. In particular:

Linux basics:

Touch typing. Since we are going to use Linux, touch typing helps. I know typing speed does not relate to problem-solving, but at least your typing speed should be fast enough not to let it get it the way and degrade the learning experience.

In general, I assume that the reader has basic C programming knowledge, and can use an IDE to build and run a program.

Status:

In the future, I hope to expand part 3 to cover more than the first 2 parts. But for the time being, I will try to finish the above chapters first.

Sample OS

This repository is the sample OS of the book that is intended as a reference material for part 3. It covers 10 chapters of the "System Programming Guide" (Intel Manual Volume 3), along with a simple keyboard and video driver for input and output. However, at the moment, only the following features are implemented:

Paging and I/O are not yet implemented. I will try to implement it as the book progresses.

Contributing

If you find any grammatical issues, please report it using Github Issues. Or, if some sentence or paragraph is difficult to understand, feel free to open an issue with the following title format: [page number][type] Descriptive Title.

For example: [pg.9][grammar] Incorrect verb usage.

type can be one of the following:

Even better, you can make a pull request with the provided book source. The main content of the book is in the file "Operating Systems: From 0 to 1.lyx". You can edit the .txt file, then I will integrate the changes manually. It is a workaround for now since Lyx can cause a huge diff which makes it impossible to review changes.

The book is in development, so please bear with me if the English irritates you. I really appreciate it.

Finally, if you like the project and if it is possible, please donate to help this project and keep it going.

Got questions?

If you have any question related to the material or the development of the book, feel free to open a Github issue.

os01 (tuhdo/os01)

Searching Database…

13.7K ·GitHub
这是什么?这是一本免费的书《Operating Systems: From 0 to 1》,带领自学者掌握从零开始编写操作系统所需的基础知识。
学完这本书我到底能学到什么?深入掌握 x86 汇编,理解程序必须如何组织才能被操作系统运行,在无标准库的裸机 x86_64 上用纯 C 进行链接与加载,以及用 gdb 和 QEMU 调试直接运行在硬件上的代码。
我没有相关经验也能直接上手吗?不太行:这本书假设你已经懂基本的 C 语言(指针、函数指针、基础算法和数据结构),了解一点电路理论(比如欧姆定律),还会一些 Linux 命令行的基础操作。
跟着学习的话,我电脑上需要哪些工具?需要一个 Linux 开发环境,用 QEMU 来运行你的操作系统,用 gdb 来调试它;这些底层工具的用法本身就是书里教学内容的一部分。
这本书是已经完成了,还是仍在编写中?第 1 部和第 2 部分(第 1-8 章)已经完成,但第 3 部分(第 9-13 章)还没写完——在这一部分里,你要自己根据规格说明去构建操作系统的各个组件。
这个仓库里有真正的操作系统代码吗?有。仓库里包含一个示例操作系统,作为第 3 部分的参考资料。它实现了保护模式、通过 TSS 进行进程创建与管理、中断和 LAPIC,另外还有用于输入输出的简单键盘和显卡驱动;分页和 I/O 尚未实现。
这本书的教学方式是什么样的?这本书只教你足以自立的最低限度:读完第 1 部和第 2 部分(共 8 章)后,你就该靠自己继续前进了。代码示例非常精简,大部分问题要靠你自己解决,网上有答案供你事后核对。
为什么这本书总让我去查 Intel 的官方手册?因为只有硬件厂商才真正了解自己的硬件。这本书不是把 x86 汇编当成一堆现成的固定知识来灌输,而是教你去阅读官方参考资料——例如第 4 章就直接配合 Intel 手册第 2 卷来学习。
学完这本书之后我可以接着学什么?作者说,完成第 1 部和第 2 部分就达到了 OSDev wiki 的最低门槛(这本书在相关主题上其实讲得更深),你也可以转去读 Linux 内核方面的书,比如免费的《Linux Insides》。
Creator
tuhdo
Size
20.3 MB
Stars
13.7K
Age
9y
Commits · 90 Days