Live data from Hacker News

Ask HN: Recommended resources to learn the Linux kernel and OS theory?

news.ycombinator.com

51–60 of 84 posts

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#51

One important part about learning how the Linux kernel works is understanding the details of the system's interface the kernel provides. In my opinion, there is no better book out there than the "Linux Programming Interface" by Michael Kerrisk: http://man7.org/tlpi/ It provides extremely detailed information about everything going on in Linux, as well as example programs and exercises to help you further your knowled…

This book is great, so is Advanced Programming in the Unix Environment, which covers much of the same material but details the differences in standards and implementation. I'd also add `Linux Kernel Development` by Robert Love.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#52

One important part about learning how the Linux kernel works is understanding the details of the system's interface the kernel provides. In my opinion, there is no better book out there than the "Linux Programming Interface" by Michael Kerrisk: http://man7.org/tlpi/ It provides extremely detailed information about everything going on in Linux, as well as example programs and exercises to help you further your knowled…

£50 on kindle! Looks like a great book, but that’s punchy. (Maybe that’s standard for a text book like this, not something I would normally buy)

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#53

The OSDev wiki can probably teach you anything you need to know about "OS theory" (and practice, mostly on x86): https://wiki.osdev.org/Expanded_Main_Page Depending on your style of programming, I'd recommend maybe not working on Linux if you are trying to learn kernel development and OS internals. Have you looked at Haiku ( https://www.haiku-os.org/ )? We have a very well organized and commented modular-monolitic ke…

Function with 9 arguments, 200 lines. Mix of abstraction levels. Basically untestable. Could use RAII.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#54
post #53

The OSDev wiki can probably teach you anything you need to know about "OS theory" (and practice, mostly on x86): https://wiki.osdev.org/Expanded_Main_Page Depending on your style of programming, I'd recommend maybe not working on Linux if you are trying to learn kernel development and OS internals. Have you looked at Haiku ( https://www.haiku-os.org/ )? We have a very well organized and commented modular-monolitic ke…

Function with 9 arguments, 200 lines. Mix of abstraction levels. Basically untestable. Could use RAII.

> Function with 9 arguments

That's nothing, let me show you some of the ones in the VM...

> Mix of abstraction levels

What are you referring to here?

> Basically untestable.

Unit-testable, no. Integration-testable, absolutely; POSIX testsuites are not so hard to write. And this function is called (tens of) thousands of times per hour while you are using the OS, remember.

> Could use RAII.

It is already using RAII reference and lock objects, what improvement do you think could be had here? There are no exceptions in the kernel, so that's not a concern.

If this is your criticism of Haiku's kernel code ... go take a look at some of the equivalents in the BSDs or Linux, then. We are by far and away better than those by your metrics (especially as, you know, those are C and this is C++.)

But do these specific metrics matter? Probably not. "9 arguments" is not a mark against a function in all cases, neither is length or abstraction mixing. Those can and usually are bad, but kernels are a different ballgame altogether.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#55
I recommend starting with something smaller.

Here's something I put together some years ago - it's about 5,000 lines of code and supports a number of key Unix features. There's a PDF of lecture notes accompanying it.

http://adelaideos.sourceforge.net/

Once you've gone through this you'll be in a better position to tackle the Linux kernel and books on OS architecture. My personal favorite is "The Design of the UNIX Operating System" by Maurice J. Bach. It's an old book but explains things well, and I believe it was one of the references Linux Torvalds relied on when creating Linux.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#56
This is a somewhat different take, and quite possibly impractical.

The main thing I've done over the years to get reasonably 'good' at the Linux kernel (and quite a few other things) has been to read every technical article appearing in https://www.lwn.net/, every week, in full, even if I didn't really understand the material. I've been doing that since 1997, and it's paid off quite well.

Also: please buy a membership, even though you don't have to. It's well worth supporting.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#58
This book has been immensely helpful to me, it's "Writing an OS in Rust" https://os.phil-opp.com/ and I can't recommend it enough.

Also, Redox OS is an OS written in Rust and has a ton of wonderful documentation on it that's been helping me get into systems development: https://www.redox-os.org/docs/

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#59
A classic: The Design of the UNIX Operating System by Maurice Bach. https://www.amazon.com/Design-UNIX-Operating-System/dp/01320...

I learned more about OS from this book than any academic material used at the university and gave me a good foundational handle on *NIX's.

Re: Ask HN: Recommended resources to learn the Linux kernel and OS theory?

#60
The Minix OS was designed as an academic, teaching OS: https://www.minix3.org/

There is a textbook that goes along with it: https://www.pearson.com/us/higher-education/program/Tanenbau...

The author famously had interactions with Linus Torvalds when he was starting Linux!

And, Minix is inside every modern Intel CPU (https://www.zdnet.com/article/minix-intels-hidden-in-chip-op...).

Post reply on HN