An Introduction To OS Development

If you – like me – are one of those mad individuals that have considered attempting to develop your own operating system, you’ll quickly hit a brick wall. Faced with sparse documentation and an extremely high barrier to entry, it’s easy to imagine that to create one is an unachievable goal. But this is not necessarily the case, and it may be worth your time.

Be A Realist. Your System Will Not Be The Next Big Thing

To create a system that stands up against the big players – Linux, OSX, Windows NT, BSD, Solaris, etc. – is incredibly difficult and requires the work of a large team of highly experienced and well-funded programmers. If you set out to achieve this goal, then my advice is simple: Forget it. It’s not going to happen. You can be the best programmer in the world, but without a large and very dedicated team behind you, it will be impossible to keep up with modern hardware features and software APIs. Besides, the world doesn’t really need another mainstream operating system. The market is already saturated, and existing products already support a ridiculously large set of features.

Rewarding: Like Climbing Everest Is Rewarding

That said, small-scale operating system development can be a very rewarding and personally valuable endeavour, and you’ll find yourself very surprised by what you can create with a little persistence. It’s an uphill struggle, but it’s one that – if undertaken correctly – will teach you invaluable lessons in other areas.

  • You’ll gain an appreciation and understanding of computer hardware. You’ll learn how a CPU works, how caches work, how the fetch-decode-execute cycle works. This knowledge will enable you to write faster, optimised code outside of the field of OS development.
  • In doing battle with a compiler aimed at a low-level build target, you’ll come to understand more about how compilers work, how they optimise code, and how you can write code that will run faster, use less memory, and be more reliable.
  • As a small OS developer, you’ll probably need – and want – to respect existing software standards in order to make sure your system is compatible with systems and software that already exist. Respecting standards – but also knowing when and where it’s sensible to ignore standards – is an essential skill when writing high-quality production software that will continue to be useful into the future.
  • Operating systems are complex projects often composed of many languages and non-standard build systems that require more than a little ingenuity to sew together. In developing your operating system, you’ll come to be more familiar with the management of a codebase and the importance of structural organisation within your code. You’ll also gain an intuitive understanding of how to fix problems and create workarounds with third-party software, a skill that definitively cannot be learned through anything but practise.

Here Be Dragons

Be careful. Operating system development is a rabbit warren of complexity and obsession. It will drive you absolutely to the limits of your sanity, and straight back into euphoria after you solve a problem that had you confused for 5 weeks running. It is not for the faint-hearted. It requires determination and persistence to make progress, but I can promise you this: if you have those things, you will make progress, even if you begin as a fairly novice programmer (as, on reflection, I did. In some ways, I still am!).

Is This What You Really Want?

Operating system development is a very specific field. It’s very common for those that begin development to realise quickly that it is not what they had expected. Don’t expect to spend your time creating window manager themes, desktop icons, or even doing anything graphics related (at first). Almost immediately, you will become bogged down into the specifics of your first target architecture, and it will be punishing.

It’s at this point that many realise that what they actually wanted to create was not an operating system, but a window manager. Or a graphical toolkit. Or a theming engine. Or a desktop environment. These are all very noble endeavours, and I encourage you to look into them. But you don’t need your own operating system to make one. In fact, making your own operating system is probably counter-productive.

Your Idea Is Not ‘Better’. But It May Still Be Noteworthy

Most that enter OS development do so with a relatively clear picture of how they want their system to look. They imagine a modern, efficient system often with some bright idea they’ve had at the core of the design.

In reality, things are not so simple. Your operating system will probably start life looking much like anybody else’s, and you’ll find as you go along that it’s often very useful to mimic the design of systems that already exist. After all, the big player OS architectures were built by some very, very smart people. They are like they are for a good reason.

That said, existing architectures are also quite old. New technology has made many parts of existing systems redundant or outdated. The world of operating system architectures is due an update this side of the millennium, but it hasn’t happened yet. The reasons for this are varied, but it usually comes down to the fact that a lot of valuable software is already built upon – and inherently tied to – old systems. Replacing those underlying systems would be incredibly expensive.

In that sense, hobby operating system development is a useful place to experiment. Much like the indie game industry, smaller projects can afford to die quickly and experiment with new and interesting ideas. So if you have an idea that you think is worth exploring, go for it. There may be hope yet.

Some Useful Skills

You don’t start climbing a mountain in nothing more than underpants and and a pair of gloves. In much the same way, it’s not a good idea to begin OS development without at least a few key skills you can rely on. Here’s a list of skills I strongly recommend you gain before starting if you don’t want to immediately be sunk be jargon.

  • A knowledge of C. Since humanity first landed on the moon, the C programming language has been at the centre of software development. While recently its use has been dwindling in the world of hosted software (ordinary software that runs on top of an operating system), it still remains the standard for embedded software development. Learn it well, and keep it close. Virtually all example code anywhere on the internet for operating system development is written in C.
  • Know your host system. Most operating system developers use UNIX-like operating systems (i.e: Linux). This is for good reason: UNIX-like systems are generally more modular than Windows, with more software development tools available in easily-accessible places. Unless you’re extremely confident with your ability to use things like custom compiler toolchains on Windows, I’d strongly recommend that you go grab yourself a copy of Ubuntu or Fedora, install it alongside Windows, and use that instead.
  • Understand the basics. Operating system development has a reputation for being difficult for a reason. Learn to read hexadecimal, understand what bits & bytes are, and make sure you understand logical operators like AND, OR and XOR. There’s a lot more to it than this though. If in doubt, you probably don’t understand enough. Go do some more reading.
  • Understand the theory. Operating systems are complex software programs. Make sure you understand what they do, how they do it, and how they work at an abstract level before you start. If you don’t understand this, then your struggle will be in vain.

Wait… There’s A Community?

The operating system development community is quite small. Anybody that sticks around for long knows that about 90% of it is composed of beginners that won’t stay for more than a week before realising that operating system development isn’t for them. The other 10% is composed of experienced programmers that usually have ongoing projects of their own but are willing to help out those wishing to get a leg up.

If you’re looking for answers to questions, be polite. Newcomers come and go every day, and nobody that can answer your question owes you anything. With patience, practise and manners you’ll gain yourself a reputation and people will be more willing to answer your questions in the future.

…And A Wiki?

Yes, there is also a wiki. You can find it at http://wiki.osdev.org/Main_Page. The beginner tutorials section is very useful, but don’t expect to find an article called “How To Make A Linux Clone”. It will help you with the basics needed to get some text displaying on the screen. Beyond that, documentation becomes sparse and inconsistent. You’ll have to figure things out by yourself.

…And An IRC Channel?

On the Freenode IRC network, there is the #osdev IRC channel. It is frequented by a large proportion of the OS development community. If you need to ask questions, it’s a good place to do so. Remember to be polite, respectful and to give as much useful information about your problem as you can. Do not annoy people on IRC without first trying to find the answer on the wiki. It is there for a reason.

Good Luck. Although You’ll Need Persistence, Not Luck

The path to OS development and beyond is a difficult but valuable one. Keep realistic, but don’t stop pushing forwards. You can, and will, get there. But what are my words worth? I’m only a few steps down the path myself…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s