Osnewscn.mezoka.com, what is the most difficult thing at first?
. One of the conclusions is that, from a technical point of view, although there are many documents on Operating System Development for reference, it is more important in project management.
That is to say, how to accurately define the concept "I want to write an operating system" to what you want to achieve, or decide to stop moving forward when you hit the wall. This series Article It is designed to allow those who are interested in operating systems to develop
People return to the correct track and leave things in their minds.
The article you are currently reading aims to help you answer a simple, but very important question: Are you really preparing to develop an operating system? For some fans, it is actually a high requirement, a waste of time
And return too late work. Many amateur operating system projects eventually reach a dead end and are slowly abandoned by its creators because they cannot understand where the direction is and what they writeCodePoor design
It cannot be effectively maintained, or it is overwhelmed when it takes a lot of time to start a small malloc () job.
Some bad reasons for trying to develop amateur Operating Systems
•I will bring the next generation computing revolution: Simply put: No. The answer is long: think of yourself as a small research team. You can make some things more orderly. Of course, this is only in small-scale situations. Without large-scale support, your products will not be distributed on a large scale. Yes, you cannot simulate an existing operating system to attract more audiences.
•I want to masterProgramming LanguageAnd requires some challenging exercises.: Some people try to learn a new programming language through operating system development and think it is a challenge to really understand the language. This is not a good idea.
---- First of all, learning programming outside the operating system development is easier than learning languages through operating system development. You should not overestimate your ability to withstand setbacks and pressures.
---- Second, because it is a new language, you will make more mistakes, and lower-layer development is better than applicationProgramThe errors at the layer are more difficult to debug. For the application layer, you can use small tools such as GDB and valgrindthose to help you.
---- Third, because you don't actually learn the language itself, but just a subset of it.
The entire standard library is unavailable. Apart from languages that work like C, many programming languages require real-time support that is sometimes unavailable to you. For example: C +
+ Exception and virtual function table, C # and Java garbage collector (garbage collectors) and Real-Time Pointer check, Pascal
Object Dynamic Array and string... Here and here are more details.
In short, writing code is very difficult. When writing code, you cannot really learn that programming language due to code limitations. Do not do this.
•Implementing a new kernel is terrible, but there is a easier way. I will use LinuxSource codeAnd adjust it until I get an operating system I need, which is not that difficult: Maybe I am the first person to introduce you to Linux source code by displaying the main. c file. Your first task is to locate the actual main function location. Your second task is to understand the position of each mentioned function and what it should do. Your third task is to take the time to understand everything.
As you should understand now, it is really difficult to modify an existing code library without a wealth of knowledge. Code reuse is a very lofty goal. It has many advantages, but now you must understand that it will not make your life simpler, but worse, because you need to understand not only the entire kernel development, but also all the details of the code library.
• I do not want to add details about X in Linux, windows, or Mac OS X, which need to be re-written.: All modern operating systems have their own weird models, especially the desktop, which is undoubtedly one of them. On the other hand, if you complain about them relatively small, you should really consider contributing patches to fix related projects. If this method fails, only the components that fail to be overwritten will be involved.
• I am looking for an exciting job:Comparison. I will bring about the next generation of computing revolution: unless you work in an operating system research office, it is difficult for you to get money from your operating system, because it has not been applied for a long time. (This may take a long time ).
Some good reasons for trying to develop amateur Operating Systems
• I want to experiment with the new operating system:Do you have any idea about the operating system and cannot find it in the existing operating system market? In your spare time operating system development, it may be a try. You can implement your ideas and see if it can be used in practice.
• I am experienced in language and looking for programming challenges, or want to know what the minimum level of my computer is:Operating system development can be done to a large extent. , You will learn how to debug the software more difficult than the text display device debugging software, learn how to do without a standard library or any form of assistance, why is there so many people on this X86 architecture that it works well on your computer because the documentation from the vendor is too bad.
• I have been working on the operating system and know that its code library is good, but there are many complaints:If you handle these complaints, it will mean significant changes. If the software is not compatible, you may have no choice but to pay, although the method described in this article is not a completely effective way for operating system development (the other method is certainly more valuable than writing a brand new operating system from scratch ).
• I want to directly patch or parallel parts, which can greatly change the operating system:It is certain that it is the best choice to start a new project. If you think you need this, welcome to the club.
• I am looking for an exciting hobby:Of course, it depends on how you define "excitement", but if you are fully prepared, operating system development can
It is one of the most exciting hobbies on Earth. This is somewhat similar to raising children or planting plants:
Of course, this is very slow. Sometimes it hits your nerves and makes you feel very thankless. But this will make the success feel better. In addition, you can have full control over computer behavior and have absolute power over hardware.
Fun.
Are you ready?
In addition to the problem stage, in order to succeed on this road, here are some things you must know or learn quickly:
• General Computer Science:You must be familiar with and be fluent in processing binary and hexadecimal numbers, Boolean logic, data structures (arrays, joins, hash tables, etc.), and sortingAlgorithm.
• Computer System Structure:All the desktop computers you should know are in the internal organization. Words Alu (arithmetic logic unit), interrupt, memory and PCI bus and DMA (Direct Memory Access) should not be mysterious to you. More automation mechanisms such as TLB (Multi-Level caching of bypass conversions, or branch prediction knowledge can be very valuable in the long run once you try to optimize code for performance.
•Compiler andExecutable filesInternal:You must roughly know what is going to happen in the Process of preprocessing, compilation, and linking binary generation, and find the tool chain that needs to be controlled in its description. You should also understand the internal structure of the linker scripts and executable files.
• Assembly language:You must know what the Assembly Language is and how it works, and you must be able to simply write the assembly program (playing with stacks and registers, Assembler Language
Statement: you must know what an assembly language is and how it works. You must be able to write an assembly program simply (play with stacks and registers, add or subtract numbers, if similar branches are implemented ). You can write operations in other programming languages.
For most of the system, but sometimes you need to complete some code snippet combination.
• C or C ++:Even if you want to write an operating system in another programming language, you need to understand C or C ++ to understand the code on the network, because you will see the operating system source code or other operating system development tutorials.
• Your system programming language:Whether you plan to use C #, Java, assembly, basic, C Language
Language, C ++, Pascal, Erlang, or REBOL to compile your operating system, you should be very familiar with it.
In fact, you should even access its internal structure description. For example, you should know how to call a function written in the language you choose from the assembly code, what type of real-time support is required for your language, and
How to implement it.
(The above list is from osdev Wiki and can be adjusted based on your personal experience. )
These wizard "Are you ready ?" It's over. If you have done this, congratulations! You should have the right mentality and enough knowledge to start the amateur Operating System Development adventure. The next article will explain how to set goals and expectations for your operating system project. If you really want to final this is really an important step.