Most people have only heard of Windows and Linux. Some of them know there is something called OS/X that is bundled on Apple computers. And, by the way, how many OS are needed? Can’t we do everything with Windows? After all, many problems would be simpler: all applications will run on any platform without problems.
For many programmers and students, life would be bitter if we all were forced to use one OS. If we enumerate all OS developed in research projects, master thesis and self-made by passionate programmers, the list becomes huge. Look at this list for example. Or this other list.
The OS that I worked on for my master thesis is not even listed there. Its name was HARTIK (HArd Real-TIme Kernel), worked on top of DOS computers (more precisely: substituting DOS). Later, it eveloved into Shark OS (Soft and HArd Real-time Kernel).
Designing and programming an OS is something quite challenging, probably the most challenging problem for a programmer. And, as you can imagine, the greater the challenge, the more the FUN. Hartik 3.0 was my creation. Mine and of my good friend Gerardo.
The previous version 2.0 was done by students before us, like Giacomo Borlizzi. However, back in 1994 the state of the art technology was Win 3.0 and DOS. So, HARTIK 2.0 was simply a program running on DOS and partly taking control of the hardware.
We rewrote hartik almost from scratch. Gerardo did most of the low level HAL (Hardware Abstraction Layer): first of all, we choose to go to 32 bits and elf executable files (DOS was 16 bit only). Our compiler was the fantastic Watcom C, one of the best ever.
Gerardo did the basic tasking mechanism, the interrupt handling and the structure of the sys calls. We implemented together the keyboard device driver. We did the scheduler together. Meanwhile, our friend Tonino was doing the porting on Alpha processors.
I did the semaphore mechanism; the ethernet device driver and the UDP/IP stack. My thesis included also a theoretical part.
It really was a lot of fun. First of all, it is not easy to debug a kernel. You do not have a debugger (*), no tracing. If you flip the wrong bit, the system just hangs up. If you do the wrong thing, you can also ruin the hardware. Just to give you an example: now all processor have temperature control enabled. If the temperature gets too high, the processor must slow down to give the fan the possibility to cool down the chip. However, the mechanism is partly controlled by the OS. If the OS fails to do the control right, the processor simply burns out.
And of course, the HD is the worst beast. Now every HD comes with smart controllers embedded, so it is difficult to ruin them, but old HS were less protected, and more exposed to the kernel programmer bugs.
Another nice thing in kernel programming is that basically you do not have documentation on device. When writing device drivers with no documentation on how the hardware works, you feel like Sherlock Holmes:
“We must fall back upon the old axiom that when all other contingencies fail, whatever remains, however improbable, must be the truth.”
Worst, some times they give you the wrong documentation. Then it’s real fun.
So, you should not be surprised to see so many people trying to build their own OS: there is a lot of crazy people out there!
(*) I have never used a debugger in my life. I tried, but I just can’t. It’s not for me.