Fog Creek Software
Discussion Board

how difficult is kernel programming?

How difficult is it for somebody doing high level application development in C++ or Java, to work with low level kernel activities, that is say you were to implement a scheduler or a virtual memory  system? I would guess it would be pretty difficult.How much time would it take to develop a VM system from scratch?

Tuesday, February 4, 2003

Depends how complex you want the VM system to be.

Go get a copy of the source to Minix, and "Operating Systems: Design and Implementation" by Andrew S. Tanenbaum - he wrote Minix and the book as an example of how to build a UNIX for a teaching tool.

That's got enough info in it to get you started on your own OS development work.

If you're thinking of something the complexity of the Linux VM system, don't. It's horribly, horribly complicated. Seriously. It's not funny AT ALL.

Katie Lucas
Tuesday, February 4, 2003

It is incredibly challanging, but that is what makes it really interesting!  Quite a few people work on 'hobby' OSes; look at and

Just expect it to suck up all the free time you have, and then some.

Tuesday, February 4, 2003

I've browsed the source of the Linux kernel: it's not too complex. Or that is, the code itself is relatively clean and as easy to get into as any massive project I've ever seen (Which means it's hard, but still...).

In any case, designing any big subsystem like a VM will always be hard, but I've found it surprisingly easy to look at or tweak the odd driver or two.

Minix is great for learning, as that was it's intent: to be simple, a learning OS.

But remember that every open source OS is a big, multi-programmer project: there will be some parts that are hairy by necessity, some that are hairy because of their authors, and some will be good. That's how software works :)

Mike Swieton
Tuesday, February 4, 2003

I've found the Linux kernel source to be some of the cleanest code I've ever read.  The directory structure is orderly, names are short but descriptive (not polluting names with "lpsz" style simpleton garbage helps).  State is not used when state is not required.

I'm guessing that one reason the code is of such high quality, is that it is subject to near infinite peer review.  Not to mention that the people working on it are of such high caliber.

I wouldn't spend time writing a VM from scratch without reading what others have done first.  Also, before posting a message to the kernel mailing list, make sure you've done your due diligence (grepping through the tree for keywords, and studying what you find).


Nat Ersoz
Tuesday, February 4, 2003

For anyone who's interested in that sort of thing, there's a complete rewrite of the VM used for Perl in the works, Perl too for that matter.  VM's called parrot, language'll be Perl6 - see

Tuesday, February 4, 2003

The Linux VM system is a Virtual *Memory* system, whereas the perl VM system is a Virtual *Machine*. And now back to the subject:

It's going to be hard if your mine has rotted with OO concepts. Kernel programming is really straightforward, once you unlearn common coding practices.

The environment is a bit unforgiving, though - almost any bug sends your machine to that big blue screen of death in the sky.

If you're thinking about Windows kernel programming, another machine and/or VMWare (or Bochs, if you can't afford VMware but can afford the time)  is essential, or you'll spend lots of time waiting for the machine to reboot, and risk data corruption.

If you're thinking about Linux, there's User-Mode-Linux (overloading the UML TLA...), which runs a kernel in user mode, giving you all the perks of user mode development, but still lets you develop kernel space apps.

If this is for education, rather than a work think, start with a simpler kernel - DOS style (FreeDos comes with source), Minix, AtheOS or something.

Ori Berger
Tuesday, February 4, 2003

*  Recent Topics

*  Fog Creek Home