views:

728

answers:

10

Programming isn't my main job, though I enjoy it and sometimes get paid for it. For many years now I've been hearing about Linux and my friends have shown to me many *nixes (or *nici?), though I stick with Mac OS.

Do you think there are any parts of the Linux kernel that I could enjoy looking at, that would help me understand what's the whole stuff about? For example, how Linux is different from Darwin?

I've grown up with assembler and DOS, so things like interrupts or low-level C shouldn't be barriers to understanding. But in the end I'm more interested in high-level concepts, like threading or networking stack - I know different operating systems do them differently. And I'm looking for something fun, easy and enjoyable, like late-night reading.

(Note: made a CW, just in case)

Update: I looked for some docs and started reading:

+7  A: 

Myself, I've always found the task scheduling code a bit of a hoot :-/

Methinks you need to get yourself a hobby outside the industry. Or a life :-)

paxdiablo
+1 from OP. You're right :)
ilya n.
+3  A: 

The comments in the kernel can be pretty funny. There's some tips on where to find the best ones on kerneltrap.

arch/sparc/lib/checksum.S- /* Sun, you just can't beat me, you just can't. Stop trying, arch/sparc/lib/checksum.S: * give up. I'm serious, I am going to kick the living shit arch/sparc/lib/checksum.S- * out of you, game over, lights out.*/

SpliFF
I was going to suggest this as well!
James Thompson
+1  A: 

You'd probably get more out of reading a book on OS theory. As far as source code goes: I've got no idea, but you could easily download the Linux kernel source and see if you can find anything that appeals.

David Johnstone
Me like English not... me like C:)
ilya n.
oh, then Pax is right - you need a life :-)
David Johnstone
+1  A: 

You might want to read or skim a book that describes the Linux Kernel before looking deep into the Linux kernel.

The books that come to mind are:

NoahD
What would you recommend among things that are (1) shorter, (2) on the Internet?
ilya n.
The second book ("The Design of the UNIX Operating System") is good, but won't tell you anything about Linux. It was written more than twenty years ago---well before the creation of Linux. What it does give you is a nice tour of the UNIX kernel of the time, describing the various modules and algorithms without diving into the code. It's out of date, but because it describes a simpler version of the kernel it's also makes it easier to learn about many of the key concepts.
Keith Smith
A: 

This should turn up some interesting code when run in the src directory:

grep -ir "fixme" *

also try with other comical terms, crap, shit, f***, penguin, etc.

Mark
+1  A: 

You need to re-define the word 'fun' in your context. :)

That said, the Linux kernel may be too much of a monster to take on. You may want to start with some academic or more primitive kernels to get the hang of what's going on, first. You may also want to consider the Jolix book.

sybreon
+1  A: 

It's been recommended by quite a few people that v0.0.1 of linux is the easiest to understand.

Though, if your looking for good kernel source to read, I wouldn't go with linux, it's a beast of a hack(about like saying the GCC sources are "fun") Instead, you may wish to try Minix or one of the BSDs(Darwin is basically a branch of NetBSD iirc) or even one of the many free DOS clones if everything else is a little too scary..

Earlz
+11  A: 
CesarB
A: 

For fun I guess you could also see Minix, it isn't exactly linux but Modern Operating systems by tenenbaum is a good read.

Ankur Chauhan
A: 

Try reading the code that implements these character devices: /dev/zero /dev/null /dev/full

And maybe the random number generators if you are inclined. The code is straightforward and simpler than all other device drivers since it does not touch any hardware.

Start at drivers/char/mem.*