There are people who live to make things. Some make cars, some make weapons, some make awesome Tesla coils, but have you ever heard of people who make full-blown operating systems for fun? Chances are, you probably haven’t, but there are indeed many programmers who are itching to take on such an extreme hobby.
Firstly, what is an operating system in very simple English? An operating system is, in theory, a relatively simple concept to understand. Naturally, it all begins with the computer itself: monitor, tower, mouse, and keyboard in all their glory, which is the hardware. But akin to any human being, no physical body can function on its own; it requires a conscious mind to operate it. This is where the operating system comes in.
In the simplest of terms, the computer hardware is a digital device, meaning each transistor on the motherboard can only process two values: 1 and 0 (otherwise known as “true” and “false”). Programs at their lowest level are written in binary “machine code”, or strings of 1’s and 0’s. When you execute a program, a stream of machine instructions are sent to the CPU which then proceeds to read them and loads up the program into RAM.
[The operating system] acts as a layer between the hardware and you, translating clicks of the mouse and taps of the keyboard into binary so that the computer can understand, as well as making sure that all the programs running are coexisting peacefully and not stepping on each others’ toes all the time.
When system developers write components for the operating system, they make use of assembly language, a low-level CPU-specific language which uses short human-readable 3- or 4-letter commands that directly translate to specific bits of machine code. Naturally, it’s a lifesaver for the purposes of writing the OS, but it is not robust, portable, and intuitive enough to use as a generalized programming language.
In order to make life easier for both users and programmers who do not want to deal with machine code directly, there is usually an operating system installed on the computer (such as Windows, Mac OS X, Linux, BSD, etc) which acts as a layer between the hardware and you, translating clicks of the mouse and taps of the keyboard into binary so that the computer can understand, as well as making sure that all the programs running are coexisting peacefully and not stepping on each others’ toes all the time.
Full-scale operating systems themselves are split up into four main components:
- Otherwise referred to as the “bootsector”, this small program is placed in the initial sector of the primary hard drive of the computer which gets launched by the BIOS. The bootloader prepares the RAM for the launching of the operating system, locates the kernel binaries on the disk and verifies their existence, and launches them.
- The giant program that acts as the core of the operating system, launching/closing programs, and instructing drivers to operate the hardware. Think of a “waiter” in a busy restaurant, serving up fresh memory or files from the hard drive to hungry programs. (Yum!)
- There are two main commercial-grade types of kernels: monolithic kernels (such as DOS, Linux, and BSD) and microkernels (such as Mac OS X and the GNU Hurd). Then there are hybrid kernels (such as Windows NT), which are an amalgamation of the previous two types. There even exists the experimental MIT exokernel design which places emphasis on the applications themselves, allowing them to communicate with the hardware much more freely and directly, should they so require, making them very lightweight and fast.
- Device Drivers
- Sets of files and programs that act as “translators” that let programmers communicate and interface with the hardware without needing to use direct binary/assembly.
- The program that provides the windows, taskbar, command prompt, cursors, desktop, etc. so that people can interact with the computer. The most well-known shells are the graphical Windows Explorer (explorer.exe) and the Mac OS X Aqua interface. In GNU/Linux & *BSD, this is either a graphical X11 shell (GNOME, KDE, Xfce, Unity, Enlightenment, Fluxbox, etc.) or a command-line interface such as bash or ksh.
Understanding the Assembly language well and knowing how the hardware works at the very low level are both necessities to make a successful operating system, and those obstacles apparently do not impede all the DIY operating system projects on the Internet (all 183 of them, to be precise).
A wake-up call
If your minds are swimming with possibilities right now on making revolutionary new operating system designs that you could show off to your friends and coworkers, I’m sorry to say that it is time to crush those dreams. It is very, very unlikely one would earn significant money and gain fame off operating system development nowadays: Windows, Mac, Linux, BSD, BeOS, AIX, and Solaris are here to stay and won’t be pushed from their pedestals by a lone developer any time soon. hey, even Linus Torvalds and Richard Stallman wouldn’t have gotten where they are today without the contributions of countless other people. So unless you have a strong public or commercial interest and a team of hundreds, if not thousands, of coders backing you up, you might as well give up those fantasies right now.
However, operating system development can be one of the most rewarding experiences you could ever have as a programmer; it is the proverbial “Mount Everest” that only the worthiest will conquer. It can test your knowledge, organization skills, coding practices and aptitudes, research abilities, patience, and frustration to the max, but should you succeed, you will come out a transformed programmer: stronger, more mature, plenty experienced, more practical and organized, and infinitely sharper and more skilled than you ever thought you would be. Many programmers never get to see much further beyond their software development kits; you would have quite the competitive edge by venturing to the great beyond that is OS development. Are you ready to tackle the challenge?
💡 To write an operating system, you must learn some C and Assembly language (the two primary languages of choice in this area), diligently research the hardware specifications you are planning to work on, and know rudimentary binary and hexadecimal.
Here are a few wonderful sites that explain how to write basic operating system components. Some of these links are step-by-step tutorials, others are purely theory and in-depth information that may require you to glean useful information from them.
- 256-Color VGA Programming in C
- alt.os.development – Google Groups
- alt.os.development FAQ Wiki
- Bona Fide OS Development
- BrokenThorn Entertainment OS Dev Tutorials
- OSDev Wiki <– See this one first, then use the other sites to supplement it!
- James Molloy’s “Roll Your Own *NIX Clone” Series
- The Operating System Resource Center
- University of Berkeley OS Development Lecture Videos
- Wikipedia article on Operating Systems
- Writing an OS Tutorials (archived from alt.os.development)
If you wish, favorite/bookmark these links so you can find them later. I hope this may help any programmer wanting to get into operating system development!