Hello, dear readers!
Have you ever written an operating system? Probably every tenth programmer, looking 10-20 years ago and recalling the beginning of his career, will answer - yes. Gentlemen, this article is not for you. This article is for those who believe in themselves and full of hope to conquer the world. I will try to warn you of some characteristic mistakes.
It so happened that among young people it is considered cool to use assembler. Most young programmers who start learning assembler want to try their hand at writing a virus or an operating system. According to statistics, more than 90% of OS writing projects in assembler end with writing a boot loader. A person gets experience, understands what he will encounter in the future, and gradually his interest fades away. Well, the lack of a result is also a result. In any case, knowledge of the assembler can be useful in the future life, for example, in the field of embedded solutions. My advice would be simple: they decided to write their own OS - take someone else's bootloader. Even in the worst case scenario, you will be in front of those 90% who will stop at the bootloader.
Let's go further. The loader is there, we write the kernel. Again, without thinking about design, young programmers arm themselves with books about the protected mode of the 80386 processor (substitute the Pentium Quad Core, the meaning will not change) and start playing with selectors, handles, virtual memory pages, etc. etc. As a result, their program really works in protected mode and, possibly, switches tasks to interrupt the timer. A good moment to gain experience and lose interest in the project or get lost in the assembly code. How to be? A good moment to stop and taking advantage of the experience gained, start designing the system. So you go to the third level.
')
So, you have gained invaluable experience and understand how iron works. What to do next? It is not enough to know how iron works. In order not to reinvent the wheel, it makes sense to study how modern operating systems work. Books Andrew Tanenbaum to help you.
I strongly advise not to undertake the implementation of a graphical window interface - the “Start” button and windows will impress only an inexperienced user. Any specialist knows that the main task of the operating system is memory and process management. Design how processes will be created, maintained and (most importantly) released. Do not forget about memory - think about how memory will be allocated and freed. And only when you will clearly understand how the process and memory management will be implemented, you can begin to encode.
The next stage is perhaps the most important. Even if you managed to design a system that controls the processor and memory, this does not mean that the system is of practical interest. There is a small chance that developers will be interested in your work. But how much do you know of embedded systems based on x86 architecture? Here I am Tom. At this stage of the project, again you will madly want to write a beautiful graphical interface. Early. It is too early. It's time to implement the file system. For any operating system, no matter how new and progressive it is, the file system is more important than the graphical interface. Even the most advanced Windows has grown from an add-in that runs on top of MS-DOS text.
Having written the file system, you will face a new problem - no matter how good and innovative your system would be, without software, it is not interesting for any person except the author. Where do you get programs for your good system? Write yourself? You can try if you are superman. Ask friends and acquaintances? Naive thoughts - everyone is busy with his own problems. Only one way out - to use already written software. And it’s very good if at the design stage you thought about this possibility and laid compatibility with any of the existing standards.
Considering the above tips is necessary, but this does not mean that following them will lead to success. This is only a minimum, without which you should not get down to business.