Few programmers ever attempt to build an operating system (OS) and many of those who try never produce a functioning system.
However, if you do make it all the way to the finish line and produce a functional operating system, you will have joined an elite group of top-flight programmers.
What is an Operating System?
An operating system, or OS, is software used by computers to manage hardware and system resources. You can think of it as the foundation on which the computer runs applications. Microsoft Windows, macOS, and Linux are the three most popular operating systems in 2022.
While operating systems are now commonplace, early computers did not have operating systems at all. Instead, each individual program had to manage everything from hardware operations to the visual display shown to the user. Operating systems made developers’ lives easier by enabling them to craft applications on top of a more stable foundation.
What Are the Parts of an Operating System?
Operating systems consist of two main parts:
- The kernel
- System programs
The kernel is the heart of the operating system. It is the first program loaded when the computer starts up. It manages computer resources and handles requests from system programs and applications.
System programs run on top of the kernel. They are not used to perform useful work. Instead, they are the programs necessary to connect the kernel to user applications and peripheral devices. Device drivers, file systems, networking programs, and system utilities like disk defragmenters are all examples of system programs.
Application programs are not part of the operating system itself. Rather, they are the programs used to perform useful work. Word processing applications, media players, and browsers like Google Chrome are common examples. Application programs are managed and enabled by the kernel and use system programs to access computer peripheral devices and hardware.
What To Learn When Programming a Basic Operating System
Programming your own operating system is more complicated than most other types of coding. With that in mind, you need a lot of knowledge and experience to take on this challenge. However, you can put yourself on the right track with three basic steps:
- Take a computer science course
- Learn low-level and high-level programming languages
- Practice computer programming
Take a Computer Science Course
OS development isn’t like web development. It isn’t something you can jump into and learn as you go. You need to develop a solid foundation before moving on to other topics.
Here are some resources to get you started:
Coursera: Introduction to Operating Systems
Coursera: Introduction to Operating Systems: In contrast to the two courses listed above, this one is devoted entirely to operating systems. You’ll learn about basic concepts like virtualization, memory management, and concurrency. This class takes about five months to complete at a pace of two hours per week.
edX: Introduction to Computer Science
Udacity: Intro to Python
Udacity: Intro to Python: If you’re brand new to programming, Python is as good of a starting point as any. This course is specifically designed for beginners and can be completed in roughly five weeks with consistent study. It won’t prepare you to develop an operating system on its own, but it will get you one step closer.
Learn Programming Languages
To program your own operating system, you will need to master at least two languages.
Assembly code communicates directly with a CPU. Each type of CPU speaks a machine language and there is just one corresponding assembly language for each type of CPU. The most common computer architecture is x86. x86 was originally developed by Intel and is now used by a wide range of computer chip manufacturers including AMD, VIA, and many others.
High-level languages work with multiple computer architectures. C is the most common language for writing operating systems. For this reason, we are going to recommend learning and using C. However, other languages such as Java and Python can also be used.
x86 Assembly Language
- The x86 Assembly Guide is a great place to start learning assembly language. This short document provides a brief overview of x86 and will set the stage for the more advanced resources you’ll be moving on to next.
- Programming from the Ground Up by Jonathan Bartlett is one of the defining books in this field. This book uses assembly language as the basis for learning CS and programming. This resource is also available from the Internet Archive.
- The Art of Assembly Language by Randy Hyde is another iconic text. Originally written specifically for Hyde’s programming courses at Cal Poly and UC Riverside, the text was released as an HTML ebook in the mid-1990s and is recognized as a defining work within the field. The text is also hosted as a series of PDF files by the Yale FLINT Group.
If you want to use a traditional textbook to learn about x86, two of the most commonly used and highly recommended texts are:
- Assembly Language Step-by-Step: Programming with Linux by Jeff Duntemann;
- Modern X86 Assembly Language Programming by Daniel Russwurm.
The “C” Programming Language
There are many high-level programming languages you could learn and many different resources you could use to learn them. Our recommendation, and the recommendation most commonly echoed by the broader community, is to learn C. We’ve found several excellent resources that will turn you into a competent C programmer.
Get a quick overview of the C language by completing this C Tutorial. This resource won’t turn you into an expert, but it will give you a good basic understanding of the language and prepare you to tackle more challenging topics and resources.
Learn C the Hard Way is a free HTML ebook that includes many practice exercises. This text walks you all the way through the C language, and if you put in the work, take your time, and complete all of the exercises, you’ll be well on your way to being a competent C programmer by the time you complete this tutorial.
If a traditional textbook is something you’re more likely to work your way through, these two texts are some of the most popular for mastering the C programming language.
- The C Programming Language by Kernighan and Ritchie;
- C Programming Absolute Beginner’s Guide by Perry and Miller.
Practice Computer Programming
With a solid grasp of computer science under your belt and some limited experience with the top languages, the next task is to learn how to tackle a large-scale programming project.
Udacity: Software Development Process is a unique course that focuses more on project management than it does on nuts and bolts. You’ll learn how to define the scope of a project and take concrete steps to move toward your goal. After completing this course, you’ll have an easier time leveraging your coding skills, turning your ideas into reality, and eventually, programming your own operating system.
OS Development Tutorials
- Linux From Scratch
- Operating System Development Series
- The Little Book About OS Development
Once you have a strong grasp of the fundamental concepts of computer science and programming, and have mastered assembly language and C, the next step is to complete one or two tutorials that walk through the entire process of developing a simple OS from scratch. We found three excellent resources that do just that.
Linux From Scratch
Linux From Scratch will walk you through the process of building a complete Linux operating system. Completing this tutorial won’t produce a full-fledged operating system, but it will give you a solid code base on which to build out a complete operating system. Tackle advanced tutorials such as Beyond Linux from Scratch, Automated Linux from Scratch, Cross Linux from Scratch, or Hardened Linux from Scratch to build your basic OS into a useful piece of software.
Operating System Development Series
Operating System Development Series from Broken Thorn Entertainment is a series of 25 tutorials that walk you through the process of creating an OS from the ground up. Beginners beware. This series assumes you already know your way around an IDE and are a competent C and assembly language programmer.
The Little Book About OS Development
The Little Book About OS Development by Erik Helin and Adam Renberg was developed as part of an advanced course the authors completed while students at the Royal Institute of Technology in Stockholm. This course walks through the complete process of developing an x86 OS, beginning with setting up a programming environment, culminating in programming for multitasking, and hitting topics such as managing system memory and developing file systems along the way.
There are many texts you could use to learn about the discipline of OS development. Three of the most commonly recommended are:
- Modern Operating Systems by Tanenbaum and Bos;
- The Design of the UNIX Operating System by Maurice Bach;
- Operating System Concepts by Silberschatz, Galvin, and Gagne.
OS Development Communities
- Reddit OS Development Channel
- Stack Exchange
Reddit OS Development Channel
The Reddit OS Development Channel on Reddit is a great community where you can learn about OS development and enjoy a moment of levity when things become too arduous.
Computer Science, Software Engineering, and Stack Overflow from Stack Exchange are places you can ask questions to other programmers when you come up against a problem you can’t seem to figure out on your own.
A Brief History of Operating Systems
- 1956: General Motors creates the first operating system to run a single IBM mainframe computer. Other IBM mainframe owners followed suit.
- Early 1960s: Burroughs Corporation, Control Data Corporation, Computer Sciences Corporation, Digital Equipment Corporation, GE, IBM, and Xerox release mainframe operating systems.
- Late 1960s: The first version of the Unix OS is developed. Written in C, and freely available during its earliest years, Unix is easily ported to new systems and rapidly achieved broad acceptance. Many modern operating systems, including Apple OS X and all Linux flavors, trace their roots back to Unix.
- 1981: Microsoft releases MS-DOS after purchasing the 86-DOS operating system from Seattle Computer Products. The name “Windows” is first used in 1985.
Learning OS development is one of the most challenging programming tasks you can undertake. However, succeeding in your effort to program your own operating system will mark you as a competent programmer and one who deeply understands how processors, hardware, and computer programs work together to create what the rest of the world takes for granted as a functioning computer.