views:

406

answers:

10

Hello friends,

I would like to build an operating system, it's one of my dreams. Before that I like to recreate ubuntu or debian or something else. but before that I need some advice and help from all my friends. I am stuck in

  • how to start
  • what languages I need to build
  • theories behind an OS
  • lots of queries etc etc etc.

I am happy if someone would join me on developing an OS. every one in this website can contribute on the project... i hope all of you revert back

Jaison Justus

+11  A: 

Consider building the Nachos operating system. Nachos is short for "Not Another Completely Heuristic Operating System".

Nachos is a course, Operating System, and set of assignments that I did in University specifically aimed at teaching you how to build an operating system. It was developed at Berkeley, but many Universities and Colleges around the world make use of it.

There are a series of assignments that you can do that walk you through each step of the way. Nachos is based on MIPS assembly code.

The goal of Nachos is to introduce students to concepts in operating system design and implementation by requiring them to implement significant pieces of functionality within the Nachos system.

Also consider buying a book on operating systems such as this one.

Brian R. Bondy
+1 Tannenbaum know how to educate and knows how to write. His first book on Operating Systems Design and Implementation (and his practicum "Minix") was the basis for an operating system called "Linux". http://en.wikipedia.org/wiki/Linux#MINIX
msw
i like to start from the beginning.. i like to understand each nuts and bolts.. building and learning new concepts.. if an os get developed make it open to all to write their own concept on it....its not for making money... for knowledge.. iam happy that alll of you respond with in 10 minutes after the post!! thanks friends....i will start doing this.... no started..
Jaison Justus
@msw: MINIX certainly was an inspiration for Linus when he wrote Linux, and I believe he ran it on his computer when he started writing Linux, but I don't think you can say that MINIX was a "basis" for Linux. Even though SCO tried that claim once, among its other attempts...
Thomas Padron-McCarthy
Not to mention Linux and MINIX are based on very different philosophies. See [Tanenbaum–Torvalds debate](http://en.wikipedia.org/wiki/Tanenbaum%E2%80%93Torvalds_debate).
Matthew Flaschen
mmmm, nachos...
Andrew Heath
is it possible to get minix codes, i mean kernels, memory manager etc...
Jaison Justus
@Jaison, yes, such code comes with the book "Operating Systems Design".
Alex Martelli
i will download minix tomorrow..
Jaison Justus
@Thomas and @Matthew, indeed "inspiration" is closer to my intent for I wasn't trying to establish a paternity claim. Thanks for the debate link.
msw
@Jaison: but do get the book too as it is far, far more than a annotation to the source (it could be argued the code is an annotation to the book).
msw
friends, iam stuck in taking decision... how to start1. start from linux kernal and build up an os or2. build a new kernal.most people advice to build a linux dist: and you will learn about kernal and more. later build your own os..what you opinion
Jaison Justus
Theory gives you a framework for understanding code you see. You can come to a theoretical understanding with difficulty through battling with the code but that is the painful path. Read a book.
msw
yep iam planning to play with minix.. got ebook of tanenbaum. how can i get to minix code. do i need to install any special pack or ??
Jaison Justus
in minix website i found two download file one a bout some 20mb and other 480mb. which one should i download.
Jaison Justus
+2  A: 

I would suggest that you look into Linux from Scratch (LFS) as a start. It is a good place to start to learn what it takes to put together a working operating system. If you are interested in actually programming an operating system, LFS is still a good start. Then you may want to look into a micro kernel for a virtual machine, learn about how CPUs work, a good place to start would be to read up on this

Elf King
-1 re-check your links, they should be http://www.linuxfromscratch.org/ otherwise this may be flagged as bogus spam
Jacob
+6  A: 

Ubuntu and Debian aren't "operating systems" -- they're distributions of the GNU/Linux OS (and a lot of add-on bits and pieces), with strong packaging help, UI tweaks, etc. (There are many other distributions of the same OS -- Gentoo, Fedora and Mandriva being some of the most successful).

If you want to build a distribution of Linux (or other open-source OS, such as a BSD variant or others yet), Python is a precious language for you (it's used in a particularly intensive way in Ubuntu, possibly in part because its ideator, Mark Shuttleworth, is a big fan of Python -- but no doubt in part because it's so good for the job).

If you want to build a brand new kernel, at the other extreme, you need strong command of C, a little machine language / assembly, and at least the kind of know-how you would get by reading several of Tanenbaum's books.

Between a bare kernel, and a full distribution (or full-fledged commercial OSs such as MacOSX or Windows 7), there is, of course, a huge number of large components (that's why GNU/Linux is a proper way to name what many call just "Linux": Linux is actually the kernel, GNU software adds compilers, shells, many utilities, libraries, and so on -- though many other crucial parts, like the graphical parts, depend on completely different components yet, most of them not related to GNU or the Free Software Foundation).

To write "the whole stack" -- from the kernel up all the way to a full, rich modern distribution -- basically requires strong competence in all kinds and areas of software development (one might except "application programming", but much of what nowadays is identified as "OS" in the sense of a full distribution is actually entirely at the application layer, so the exception isn't really one;-).

So, you need to clarify, or at least prioritize!, your desires: do you want to start with the parts that "run on the bare metal" and present more usable facades for it to every other piece of code on the system -- i.e., the kernel -- or take existing kernels &c, and build a full-fledged distribution on top of them... or, what else?

Alex Martelli
i like start with a new kernel. i think it will let my knowledge to grow....
Jaison Justus
how can i start from the beginning?
Jaison Justus
marty, i think you are right!! before building a kernal, decompose an existing kernal and learn how it is..... is it
Jaison Justus
@Jaison, buy and study Tanenbaum's books (or other good ones) that teach you how to program a kernel -- if you pick Tanenbaum, start with http://en.wikipedia.org/wiki/Operating_Systems:_Design_and_Implementation . If you want to start for free, try http://www.osdever.net/bkerndev/Docs/intro.htm , and http://www.osdever.net/tutorials/pdf/ckernel.pdf .
Alex Martelli
@Jaison, that's what Tanenbaum's book which I recommended is doing: it shows you how to build an OS by presenting a really simple existing one, known as "Minix" (originally some bits and pieces of Linux used Minix inspiration, though they got all replaced pretty soon and no trace remains -- a famous Tanenbaum-vs-Thorvalds online debate may have some connectiom, see http://oreilly.com/catalog/opensources/book/appa.html for more).
Alex Martelli
i found two books from tanenbaum1.Operating Systems Design and Implementation, 3/e2.Modern Operating Systems, 3/ewhich one you prefer?
Jaison Justus
@Jaison, the classic Operating System Design is the one I pointed to a couple comments ago -- Modern Operating Systems gives no such reference implementation as Minix.
Alex Martelli
A: 

If you want to enjoy the wonders of OS creation but from the comfort and safety of a high level / managed environment and language, you might also want to have a look at Cosmos ( http://www.gocosmos.org/index.en.aspx ).

lzcd
+2  A: 

An operating system is a pretty complex beast and depending just which definition of operating system you're using it can be something that's absolutely huge and pretty much impossible to do on your own or simply extremely difficult.

Having said this: a kernel and basic system library is probably the first thing you want to have running. The kernel must provide a few minimum functionality, including interprocess communication, memory management and process management -- everything else can be implemented outside of the kernel proper and can be done in userspace. The system library must in some way allow userspace programs access to the kernel.

Having written a minimalistic kernel (aka a "microkernel") and a system library is just the first, very small step. On top of this you will have to have a bootloader (for loading the kernel), a link-loader, a set of compiling tools (compiler, assembler etc), disk driver, keyboard driver and a video driver. Some of these can be left out or replaced with more complex systems (such as a network driver replacing the disk, video and keyboard driver and only allow communication with your OS over a network!) that provide the same functionality.

I would generally not recommend writing your own bootloader: there are already plenty of bootloaders out there and if you're doing an OS for x86/x86-64 machines, you can use any Multiboot-compliant bootloder, such as grub, without doing any real work in your kernel. It only requires that you add a bit to your kernel (which you can in fact leave out if you want to -- if you do you just won't be able to benefit from the bootloader's facilities).

Regarding programming language: well, assembly is a must. You won't get much done if you aren't using it. Most of the OS should be in any other language (pick one that you like).

Clearer
+1  A: 

Try the OSDev.org wiki, and also the OSDev.org forums if you want to look into writing a homebrew system from scratch rather than creating a Linux distribution.

Everything you need to know to begin is right there.

Also, this tutorial, whilst somewhat buggy at times (author is aware and slowly rewriting the tutorials) is a nice springboard into development - the theory explanation at least is fantastic.

Matthew Iselin
A: 

Ask yourself what you really want to build. Is it really an operating system? Do you want to rewrite all of the bits which deal with hardware? That's what the operating system does. If you aren't really into that low-level stuff perhaps you want to build something else.

Winston Ewert
A: 

Writing an Operating System is a worthy and noble goal as the world needs a better one! I suggest that you get a copy of Operating Systems Design and Implementation and carefully study it. It contains an explanation and complete source code of Minix, which greatly influenced Linus Torvalds in the design of Linux kernel.

Vijay Mathew
A: 

I found Andrew Tanenbaum's classic "Operating System and Implementation" ( http://www.pearsonhighered.com/educator/academic/product/0,,0131429388,00%2ben-USS_01DBC.html ) a decent read on the subject and the resulting operating system, Minix, can be found at http://www.minix3.org

lzcd
A: 

Before you get your hands dirty with code you can't miss this link: The Operating System Resource Center http://www.nondot.org/~sabre/os/articles

Clearly x86 biased but a great guide to low-level stuff from the boot process to hardware interfacing.

asr