Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
A custom OS kernel is easy. It's sometimes done as a project in a graduate or upper division CS course. The drivers are the hard part. Maybe a couple to few dozen man-years if you can find enough documentation on all the hardware and CPU configuration needed. Then the libraries and frameworks on top of that can take hundreds to thousands of man-years. Enjoy.

Usually done in C, with tiny bits of assembly for the stuff that's invisible to the C compiler (process state save/restore, cache and TLB/page table setup, & etc.)
 
...
As it happens, you can still read some of his conversations with Andrew Tanenbaum on usenet. Tanenbaum is a professor who specialises in teaching OS design. He even built a teaching OS called Minix. The name Linux is a bastardisation of the Minix name, I guess because Linus was studying Minix at the time.
...

Wow. That takes me back.

I did a project in University (a loooong time ago :) that involved adding interprocess communications to the Minix kernel

Every change meant recompiling the kernel. On an IBM PC AT with a 286 processor, it took all night! Never did get it finished.

BTW I always assumed both Minix and Linux were variations on Unix.
 
as someone who knows operating systems, i can say with a level of confidence that you have no idea what you are talking about.

Yes! You don't have to know Assembly either. You can write an OS in any high level language including Java.

Probably the best place to start would be to take a course on Operating Systems, and if that's not possible, reading a book on Operating Systems. That will give you an idea of what an OS is, and which parts of an OS you want to write.

Then you simply write the different parts of the OS. Compile it for your architecture, and away you go.

It is easier than you think, and it is a fantastic idea. It gives you a great understanding of computers.
 
Wow. That takes me back..

BTW I always assumed both Minix and Linux were variations on Unix.

Some thoughts. Used to do system software programming professionally, have ported several Os-es to new hardware.

There are a few functions that are difficult to implement in pure c. Traditionally they would require assembly language. But quite often today the compilers support special pragmas allowing you to write interrupt routines directly in c. On small processors ( say 8 bit embedded systems) you can generally write the whole stuff directly in c. Now, if this defines as an operating system is a different thing.

It is also several magnitudes of difference between different os. A small os for an 8bit processor might be a few hundred lines of code. A large system like Mac-Os might be several million lines of code. Both are os-es.

I suggest starting with low level stuff, maybe this might be a solution
http://processors.wiki.ti.com/index...G2)?DCMP=launchpad&HQS=Other+OT+launchpadwiki

And finally, unix, minix, linux.

No they are not really variations. Definetely minix was inspired by unix and linux was inspired by minix and unix. One goal was to give application programs the same interface as unix. This would allow a programmer to easily port the user programs from one os to another, often by simply recompile the program. This goes omly for the commmand line programs, terminal in osx. Hardware driver programming is very different. The graphical front ends are new additions where the os-es each has taken their own direction. Mac-Os is very different from each and every linux variation in porgramming graphical applications. Even old and new versiona of Mac-OS is quite different in that respect.

Sorry, some ramblings from an old grunt.

Gunnar
 
Um, Darwin is written in Objective-C.

No its not. Not even core foundation is written in objective C, and that sits on top of darwin...

Whilst you can get away with writing SOME parts of an operating system in C or other higher level languages, at the ground level, to write drivers for hardware, boot code, etc - you need to know assembler.

Even if you're writing code in C, you often need to know assembler, and/or the low level workings of the device you are dealing with to be able to get things small enough and efficient enough.


If you are trying to write a boot loader, you're never going to manage it in C, let alone Java, lol.... there's simply nowhere near enough space to work with - you wouldn't even be able to fit the JVM in there, let alone your actual code...


And yes, starting out, you'd be better off picking some simple hardware (ideally 8 bit) and starting out with that to get the core concepts nailed down.

If writing an OS was easy, Apple wouldn't have bought NEXT, Linux wouldn't still be a 5+ years behind Windows and OS X in terms of hardware abstraction and user friendliness, and Microsoft would have been toppled many many years ago.


Also: as said, "operating system" is a very generic term.

The commodore C64 had an operating system. DOS was an operating system. Something like Windows NT or OS X is many many times larger, far more complex and provides a lot more services for an application programmer to make use of.
 
Last edited:
...
And finally, unix, minix, linux.

No they are not really variations. Definetely minix was inspired by unix and linux was inspired by minix and unix.
..

I was really just referring to the names, not the OS's themselves 8).
 
Just found this. Those were the days ...
http://www.youtube.com/watch?v=Q07PhW5sCEk&feature=youtube_gdata_player


I was really just referring to the names, not the OS's themselves 8).
Aah. Agree. Names are definitely inspired by. Unix. There was also a Multics before that which did influence Unix quite a bit.

http://en.wikipedia.org/wiki/Multics

Gunnar

----------

This page would be a good start:

http://wiki.osdev.org/Introduction

Real good starting point. Perhaps a bit too towards "mac osx" or "windows" type os, booting from a hard disc and showing a gui. Not all os-es has hard disc and not all interavt through a gui or even a terminal like interface. Regardless, I found a lot of interesting things at the site. Thank you for the link.

Gunnar
 
Last edited:
Pintos (from Stanford) is a great tool to learn OS development

If you are serious to learn about operating system development, I recommend to use the Pintos educational operating system developed by Ben Pfaff at Stanford. It is written in C for x86 architecture and runs in a virtual machine. It comes with great documentation and a set of projects, that guide you from simple tasks, like efficient event (and time) mechanisms to complex things like virtual memory, file system and threading. I used it with great success to teach Operating Systems at a college, and the students loved it.

Look here: http://en.wikipedia.org/wiki/Pintos
and here:
http://www.scs.stanford.edu/10wi-cs140/pintos/pintos.html#SEC_Contents
(the second link goes to the official documentation, which includes the download link)

Have fun!

Manfred
 
Curses, now I will be off spending a week reading up on GNU/HURD, vainly hoping that they might make some progress with it. Modularity sounds like such a wonderful idea.
 
Are they still switching kernels every time they get a userland running?

They have a sort of alpha version running on a Mach. The Viengoos thing looked interesting, but it has not been touched in 3 years. L4 seems to have been too much of a problem, I am not entirely clear why. For a quarter century of work to reach this level, one has to wonder about the real viability of the project, I am thinking some sort of OOP-based global architecture might be more suitable than the daemons scheme.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.