40

what is a way to create a my own operating system using c++. I have been created boot loader (using nasm,qemu) but I haven't knowledge to add an kernel to this boot loader.

3
  • 15
    I think this is actually a nice, constructive question.
    – Renra
    May 13, 2014 at 15:48
  • 2
    Maybe it's broad to its nature but it definitely gave me good hints to explore
    – Renra
    May 13, 2014 at 15:55
  • 3
    There are no dumb questions, only dumb people.
    – SasQ
    Jan 29, 2015 at 17:31

7 Answers 7

13

Be careful, C++ is pretty heavyweight for an OS kernel.

  • There are services like exceptions that you'll have to support with a runtime library.
  • It won't feel like C++ until you add a heap.
  • Kernels are very sensitive to where objects are allocated; the one-heap model usually used in C++ isn't really suitable.
  • Coupling APIs to data structures is a bad idea. BeOS had problems with this. You need to hide the size of your internal structures from users, and that means jumping through hoops (Pimpl, private constructor, virtual functions) when APIs are member functions.

It sounds like you're already further along than most, so keep asking questions and you'll probably end up somewhere nice! :vD

8

Also to add, This book by Tanenbaum, where he explains the implementation details of minix.

2
  • 1
    +1: I have that book, and was going to suggest the same. Even if you don't end up using the same concepts as Tanenbaum, at least you'll know what those concepts are!
    – Kaz Dragon
    Jan 27, 2010 at 9:25
  • Excellent book...enjoyable read ;)
    – t0mm13b
    Feb 3, 2010 at 18:24
6

You may consider looking at MINIX which is a small operating system for x86 systems. It was originally designed as a teaching project and has evolved into something that's intended to be useful in the real world.

2

I am not familiar with details, but by my knowledge BeOS was written in C++. Sources should be freeley available as well as the documentation.

1
  • For the kernel you can look at newos.org (written an ex-Be employee and being used by haiku-os.org for their Be clone). Jan 27, 2010 at 10:17
2

For a C++ operating system, you may want to look at NewOS or UnixLite.

2

you can take a look at minix 3 source code. it's a very simple os, created with the purpose of understand how operating system works.

you can also study all the tanenbaum book about os. they are all very complete and I remember that one book has the complete source of minix attached and commented

1

A usable operating system can be developed on the top of L4, even by a single student in one semester along with other courses (but with all driver issues already resolved). If found this being a great adventure, and the L4 microkernel is also kind of advanced.

Not the answer you're looking for? Browse other questions tagged or ask your own question.