But how does that small assembler boot bootloader the commands from the OS?
Since you cannot do much in 512 bytes of code (although, in fact, a bootloader is not strictly limited to 512 bytes), a bootloader would usually do not much more than load a larger block of code from a disk into RAM and then execute it.
Does the bootloader continue running and still acts as a "transmitter" between software and hardware? Or is the control completely given to the OS?
I think that once the bootloader code has done its work, and jumped to the additional code that it has loaded into memory, it can then be overridden, since it s no longer needed.
Why are all bootloaders written in assembler?
I suppose this is mainly for one reason: If you write a bootloader in a high-level language, the produced code would quite probably rely on some sort of runtime library, containing essential functions. Those are, however, often not needed for a bootloader, and would therefore bloat its code size.
And why do you have to go back from C++ to C when writing an OS?
You don t strictly have to. It s just that C code is closer to the machine than C++. With C++ you can t always guess what code will be produced, and whether that will be as efficient as you would like.
Edit: I ve also heard the argument that some OS developers stick to the C language because there s less choice in different programming paradigms and styles than e.g. in C++. Therefore its easier to work for a team with the common code base, because everyone will write more "similar" code. (Since I haven t myself been involved in any open-source or OS development, I can t judge from experience whether this is a valid statement or not.)