Home » Operating System » How to Make a Computer Operating System
How to Make a Computer Operating System
Catherine Garcia
Comments off
Table of Contents
ToggleLearning the Basics
-
Take some basic Computer Science courses. Unlike developing for the web, creating an operating system requires a strong understanding of algorithms, data structures, computer hardware, and resource management.[1] People get degrees in this stuff, so don’t expect to write an entire operating system after reading an online tutorial! Harvard’s Intro to Computer Science course is available online through EDX at no cost.
-
Learn a high-level programming language like Python. Once you’ve got a solid foundational understanding of computer science, the next step is to master C and/or C++. Like learning about computer science, mastering a language is not optional—you won’t be able to code an operating system if you can’t write solid applications.
- If you’re brand new to C, check out Dartmouth’s C Programming: Getting Started course, which is free through EDX. Once you complete that course, you can take the next course in the series: C Programming: Language Foundations. Then, move on to subsequent courses like Modular Programming and Memory Management and Pointers and Memory Management.
-
Learn an assembly language. Assembly languages are low-level languages designed to communicate with different processors. Since assembly is different for different processor types (e.g., x86 assembly Language for Intel, AMD, VIA, and other processors), you’ll need to learn the version for the type of processor you’re coding for.
- This open-source book, if read in its entirety, can give you a solid enough understanding for building an operating system.[2]
- The Art of Assembly Language is a highly-recommended book about assembly available both on and offline.
- You should also do a lot of research on the type of processor(s) on which your operating system should run. The manuals for processor architecture can easily be found using a Google search (“Intel Manuals,” “ARM manuals,” etc.).
-
Complete an operating system tutorial. OS tutorials will walk you through the process of creating a basic operating system. This gets you used to the process and helps you figure out if there are any pieces you’re missing. Once you’ve completed a tutorial or two, you’ll be well on your way to creating your very own operating system.
- Bare Bones is a tutorial that helps you write your first simple 32-bit kernel. After completing the tutorial, the next step is to use Meaty Skeleton to structure your own operating system.
- Linux from Scratch is an online book that walks you through creating your own Linux operating system.
- Operating systems from 0 to 1 is a free book about creating various operating systems from start to finish.
-
Figure out your operating system goals. What do you want your operating system to do? How should it look? Do you really need to write an entire operating system or are you just looking to create a certain look for your desktop? These are all things to consider before beginning to code.[3]
- Consider developing with a team of other programmers. Having a team of developers working on the project will cut the development time significantly.
- Add your project goals, plans, and questions to your public repository so it’s easy for others to help you.
Building Your Operating System
-
Choose a development environment. This is the platform you’ll be using to code your new operating system. It’s a matter of personal preference, but most people either use Windows or a flavor of UNIX. If you’re using Windows, it’s a good idea to install a UNIX environment like Cygwin or MinGW. You’ll generally want to make sure whatever environment you’re using includes the following:
- GCC (the Gnu compiler). If you’re using Windows, you can install it in Cygwin or MinGW.
- Binutils is a collection of tools used for manipulating object files. Again, if you’re using Windows, you can install it in Cygwin.
- A good text editor. Vim and emacs are commonly used in UNIX environments. Windows users can use Notepad, or check out Notepad++ for a multi-tab upgrade.
- Perl and/or Python. One or both are recommended for string manipulation.
-
Set up your version control system. Writing an operating system means you’ll likely be creating hundreds (or thousands!) of lines of code. When you’re working on revisions, this can get confusing. Some options to check out are CVS, Mercurial, and Subversion.
-
Decide on a bootloader. If you don’t want to create your own, you can use an existing one like Grand Unified Bootloader (GRUB). If you do feel daring enough to code a bootloader, check out Rolling Your Own Bootloader on OSDev.org.
-
Choose a kernel design. The kernel is the core of your operating system, providing an interface between the user and the computer hardware. There are monolithic kernels and micro kernels. Monolithic kernels implement all the services in the kernel, while microkernels have a small kernel combined with user daemons implementing services. In general, monolithic kernels are faster, but microkernels have better fault isolation and reliability.
-
Start small. Begin with small things such as displaying text and interrupts before moving on to things such as memory management and multitasking. You can also try making a simple 16-bit Operating System, instead of taking a big leap.
- You will not have a full system in two weeks. Start with an OS that boots, then move on to the cool stuff.
-
Test your new operating system with a virtual machine. Rather than rebooting your computer each time you make changes or having to transfer the files from your development computer to your test machine, use a virtual machine application. VMWare is a common option that works with both Windows and Linux, and so is Bochs. Check for potential deadlocks and other bugs and repair them as needed.
-
Release a “release candidate.” You can do this by uploading your tested code to your public repository. This will allow people to test your operating system and report back on any issues they run into.
-
Network with other operating system developers. There’s an entire community of operating system developers congregating on various forums, including /r/osdev on Reddit and the Software Engineering Stack Exchange. One you’ve gotten a grasp on developing a basic operating system, read existing posts to see what kind of things come up during the development process.
[“source=wikihow”]