The author tells the story of an operating system.

Source: Internet
Author: User

Orange
'
S
: Implementation of an operating system
Preface by author
This book is the second version of "write your own operating system". It presents a prototype of operating system implementation process to readers through a specific instance. There are a lot of books on operating systems, but there are rare books that focus on how to help readers implement a pilot operating system. This book starts with a simple Boot Sector, this article describes the growth of an operating system for your reference. This book is intended for practice and teaches readers how to develop their own operating systems through specific examples. The steps in the book follow the steps from small to large and from simple to deep. With these steps, the reader can gradually improve the Code and Expand functions by starting with the simplest guide sector, finally, a small operating system is formed.
This book not only introduces the various elements of the operating system, but also covers all aspects required for the development of the operating system, such as how to establish a development environment, how to debug and how to run in a virtual machine. The instance operating system in the book uses ia32 as the default platform, so the protection mode is also used as a necessary knowledge reserve in the book, which is often ignored in traditional operating system practice books. In short, as long as you develop the knowledge you need in your own operating system, the books are all involved as much as possible for your reference.
As we all know, a molding operating system is often very complicated. Considering the special position of the operating system as a bridge between hardware and software, it may seem more difficult to understand than the general software system, because its core components often contain many operations that directly target CPU, memory, and I/O ports, they are mixed in a piece of code, which is even more obscure.
We have many open source code operating systems that can be downloaded and read at any time. It seems that it is much easier to implement a micro-operating system for ourselves, but the facts are often unsatisfactory, because these codes are prone to tens of thousands or even dozens of millions of lines, and details are often associated with each other, it is not easy to understand them. We have a lot of easy-to-get operating system tutorials, but it seems that we have a gap and are not very close to each other. The root cause is that the learner has been facing a complete operating system from the very beginning, or has accumulated a series of theoretical achievements for decades. No matter how good the author is at writing, how intelligent the reader, or how good the code is, it is very difficult for a beginner to understand the clues.
I am not alarmist here, because it was my personal experience. Of course, a few operating system theory books are enough for the exam, and you do not need to be so clear about the details. But what if it is out of interest? What if you want to write your own operating system? You will find that theoretical books seem useless at once, and you will find that any misunderstanding in any details may lead to your own Xin
The Code that has been hard-coded has run abnormally or even crashed.
I have experienced all this! I have read a book "Operating System: design and implementation", and I have not found out where to implement an operating system. It's not that these books are not good, nor that the code of their predecessors is not good, but that we don't know anything about beginners. What we don't know is not just the theoretical knowledge of the temple, there are also practical details that make us difficult.
In the eyes of the authors of these textbooks, the operation details are not part of the course, or these details seem too easy to mention, even the author believes that these are part of the so-called "experience", and the conventions are made by the readers themselves. However, the actual situation is that the content neglected in these books takes most of the time for a beginner, and even affects the enthusiasm for learning. I still remember the frustration I suffered when I started writing my own operating system. It was a sense of helplessness that I didn't know how to proceed. Fortunately, I persisted, overcame various difficulties, and completed the prototype of my operating system.
In addition, I think that I am not only interested in writing my own operating system, but also have difficulties in practice. Maybe I should write down my own experiences to help those who are similar to me. In this way, I wrote the first version of this book, that is, "write an operating system by myself". I believe that if you are curious about the magical computer world and want to write your own operating system to learn the story behind it, you can certainly get some help in this book. And I would be very happy if you have renewed your enthusiasm for practice because of my book and started an operating system journey.
But I have to confess that when I write "write an operating system by myself", I am not sure how much reaction it can cause. On the one hand, the operating system is not a fashionable topic, on the other hand, I am also on the way to learning, maybe just a small step ahead of the reader. However, to my surprise, it was re-printed many times after its launch, and even ranked first in the sales ranking. This made me feel that it indeed has some reference value, I would like to take this opportunity to thank all the readers who have supported me.
When I wrote "write an operating system by myself", I did not think that there will be a second version today. The reason is that I hope this book is used to fill the gaps, rather than repeating what others have done well. The so-called fill in the blank, specifically, is to allow operating system enthusiasts like me to read other popular open-source operating system code with confidence after reading this book, the ability to write the operating system from scratch, and the first version of this task has been completed.
So why did I write the second edition? There are several reasons. First, although the first version of inter-process communication, file systems, and other content that has not been involved are explained in many books, I still feel that there is a common problem of unknown language when I read it. The author may be very clear about the original committee, however, it is too simple to be clear to the reader. Second, I want to draw a circle myself. Although the first version of the book has completed its mission, after all, at the end of the book, the reader does not see a real operating system. It has no file system, no memory management, and cannot do anything. In the second version, you will see that you can write applications for our experimental OS by means of cross compilation. That is to say, it already has the basic functions of the operating system, although it is still very simple, the first circle is already round. Third, there are still too few practical operating system books, so that if you want to see how others do it, apart from reading a very small number of books represented by "Operating System: design and implementation, that is, it is written into the source code, and the results are sometimes quite frustrating. I am also discouraged, so in the second version, I still try to make a little more detailed and share my experience. In addition, I chose the most streamlined design that I can think of, so that the readers do not fall into too many details and cannot see the whole picture. I think this is the potential value of this book-simplified and easy-to-understand design, as well as text as detailed as possible.
In this version, the content is divided into the next two articles. The previous article was basically the revision of the first version, but only made an adjustment, that is, based on the consideration of both Windows and Linux users, by default, a development environment is established in Linux to compile the operating system. The reason for doing so is described in Chapter 2nd in detail. Of course, the development environment is the second place after all. The content and involved code in the book are consistent with those in the first version. The next part of this book is fresh content, mainly increasing inter-process communication, file system and memory management. Similar to the practice of the first version, the next article focuses not only on results, but also on presenting the process of forming a result. At the same time, the book aims to share and lead the way, so it simplifies the design as much as possible to highlight the most important part. Readers will see how simple the file system and memory management of an operating system can be. Simplicity is not a disadvantage. For Beginners, we need to start with simplicity. In other words, if you have some experience implementing an operating system, this book may not be suitable for you. This book is suitable for beginners who have never written an operating system.
The layout of this book is completed by latex. I spent some time in formatting, because I hope that the reader will first buy a book that is easy to read and pleasing to the eye, and the second is the method for compiling the operating system. In addition, the Code listed in the book is automatically embedded into the latex source file by my own program, so as to strictly ensure the consistency between the certificate and the CD, you can easily find the exact location of the Code on the disc based on the file name and row number.
In addition, there are some minor changes in the second version. The first reason is that the operating system name has changed because although our experimental OS has learned a lot from our predecessors, the design of each part (such as file system and Memory Management) I often have their own uniqueness, so I changed the old tinix (originally try minix) to the new name Orange's (this name comes from my wife) to indicate their differences. In addition, the Code style in the book has been adjusted in some places.
I think that although the second version has had such a change, it has not changed. That is, this book tries to tell readers as much as possible about my experience in writing my own operating system, at the same time, I try to present my original ideas and coding process as much as possible. It is likely that readers are smarter than me and have better solutions to problems, but in any case, I think my own experience can be used by readers. If so, I will be very pleased.
During the preparation of the second edition, I would also like to thank many people. I would like to thank my parents and grandfathers for their love for me and hope that my grandfather will not worry about me. Writing books is a hard task, but it also brings me a lot of GAINS. Dad helped me correct the text at the final stage of the second edition. This book has your credit. I would like to thank all my friends from the perspective of Bowen, Miss Guo for his understanding and support, Li Ling for her hard work, and Jiang Li and Li Bing for your high efficiency. I would also like to thank teacher Meng Yan for your encouragement. I would like to thank Guo Hongqiao, my best friend, not only for your technical help, but also for your spiritual support. I would like to thank my colleague and friend Zhang huichang for their technical breadth and depth. In addition, I would like to thank you again for helping me in the first version. Because there is no first version, there will be no second version.
Among all of you, I would like to thank you most. It is my wife, Huang Danhong. Thank you for all your suggestions and the pictures you have drawn for me. In particular, when this book was not completed in the time I expected, and when I encountered difficulties that could not be solved, you always encouraged me, I have always felt a kind of warmth. I know that without your support, I can't stick to it and I will finish writing. Thank you. This book also belongs to you.
Compared with the first version, the content of this book involves more aspects of operating system design. However, due to the limited level of the author, it is inevitable that there will be omissions or even errors. If the reader has any questions, comments or suggestions, log on to the http://www.osfromscratch.org and let us discuss and make progress together.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.