We continue to write OSes. Step by step

I was prompted to write this post by the fact that iley posts stopped, but the habralum still wanted axial posts. I will make a reservation right away, I myself study and write a small axis, but I study , so we will move forward together. I am going to consider writing systems under protected mode for IA-32, talk about:
1) Design;
2) Debugging;
3) Work with graphics;
4) Work with disks;
5) Memory management;
6) Task management;
Maybe something else if it is in demand.

I) Design.
But in order not to be unfounded, let me begin with a story about design.

1) So, let's start with the idea of ​​writing our axis - why is this? You probably already know the answer - the study of architecture, understanding the operation of processors and peripherals. This is right.

2) Next - what type of kernel to use?
Let's list the types and features of cores:

1) Monolithic.
The name speaks for itself: a huge piece of code works in one common address space, it is difficult to expand, when one part (function, I don’t know how to call it better) falls, the whole kernel falls.

2) Modular.
This type has arisen due to the evolution of system architectures. Here the functionality is divided into modules, each of which is responsible for its own special function. However, all these modules work again in a single address space, which affects the security of the entire system. In principle, the modular core is a subset of the monolithic.

3) Microkernel or µ-core.
Here everything is approximately the same as in the modular core, only services (modules) are executed in different address spaces.

Honestly, it’s better to start with a modular kernel because it is the most down-to-earth and primitive.

Further, the developer is free to come up with his own concepts, implement them.

Next, we decide what our system will be: monotask or multi. In my opinion, it is better to start with a monotask, and then develop it further.

Now about the bootloader: some use the famous GRUB or LILO, but in my opinion it is better to write it yourself. An example for parsing for me personally was the bootloader from KOLIBRI, the benefit of the opensource project; we take the best debugger for beginning coders - a notebook and a pencil, and we sort the bootloader into shelves.

File system : it’s generally better to start with FAT, then move on to others. Some decide to write their own, and that’s good - the architecture and work with disk drives are very clear.

Now let's talk about services (since we started the modular core).

It’s nice to implement the following:

1) Video service: printing, standard screen functions.

2) Disk service: we assign all operations with disks to it - from transferring THS to LBA to operations with flash drives.

3) Memory management service: here the name is clear. Although this is the most difficult part in implementation and theory.

4) Task management service: this is also not an easy task, but we will still approach it.
Here, in principle, is the first, general overview. Until the next release!

Also popular now: