<p>I'd like to gain better knowledge of operating system internals. Process management, memory management, and stuff like that. <br>
I was thinking of learning by getting to know either linux or BSD kernel.<br>
Which one kernel is better for learning purposes?<br>
What's the best place to start?<br>
Can you recommend any good books?<br></p>

[{'answer_id': 24667, 'author': 'thelsdj', 'author_id': 163, 'author_profile': 'https://Stackoverflow.com/users/163', 'pm_score': 3, 'selected': False, 'text': '<ul>\n<li><a\nhref="https://rads.stackoverflow.com/amzn/click/com/0596005903" rel="noreferrer" rel="nofollow noreferrer">Linux\nDevice Drivers</a></li>\n<li><a href="https://rads.stackoverflow.com/amzn/click/com/1576104699" rel="noreferrer" rel="nofollow noreferrer">Linux Core Kernel Commentary</a></li>\n<li><a href="https://rads.stackoverflow.com/amzn/click/com/0131429388" rel="noreferrer" rel="nofollow noreferrer">Operating Systems Design and Implementation</a></li>\n</ul>\n\n<p>I had previously bought these books on recommendation for the same purpose but I never got to studying them myself so only take them as second-hand advice.</p>\n'}, {'answer_id': 24668, 'author': 'sir_mud', 'author_id': 2647, 'author_profile': 'https://Stackoverflow.com/users/2647', 'pm_score': 3, 'selected': False, 'text': '<p>As a Linux user I\'d say Linux has a great community for people to learn about the kernel. <a href="http://kernelnewbies.org" rel="nofollow noreferrer">http://kernelnewbies.org</a> is a great place to start asking questions and learning about how the kernel works. I can\'t make a book reccomendation, but once you\'ve read the starting material on kernelnewbies the source is very well documented.</p>\n'}, {'answer_id': 24682, 'author': 'Mike Stone', 'author_id': 122, 'author_profile': 'https://Stackoverflow.com/users/122', 'pm_score': 5, 'selected': True, 'text': '<p>In college, I had an operating systems class where we used a <a href="https://rads.stackoverflow.com/amzn/click/com/0003458903" rel="noreferrer" rel="nofollow noreferrer">book by Tanenbaum</a>.  In the class, we implemented a device driver in the <a href="http://minix1.woodhull.com/teaching/teach_ver.html" rel="noreferrer">Minix operating system</a>.  It was a lot of fun, and we learned a lot.</p>\n\n<p>One thing to note though, if you pick Minix, it is designed for learning.  It is a microkernel, while Linux and BSD are a monolithic kernel, so what you learn may not be 100% translatable to be able to work with Linux or BSD, but you can still gain a lot out of it, without having to process quite as much information.</p>\n\n<p>As a side note, if you\'ve read <a href="https://rads.stackoverflow.com/amzn/click/com/0066620732" rel="noreferrer" rel="nofollow noreferrer">Just for Fun</a>, Linus actually was playing with Minix before he wrote Linux, but it just wasn\'t enough for his purposes.</p>\n'}, {'answer_id': 24732, 'author': 'Steve M', 'author_id': 1693, 'author_profile': 'https://Stackoverflow.com/users/1693', 'pm_score': 3, 'selected': False, 'text': '<p>Aside from the good books already mentioned (Opeating System Design &amp; Implementation is particularly good), get a hold of a 1.x release Linux Kernel, load it into VMWare or VirtualBox and start playing around from there. </p>\n\n<p>You will need to spend a lot of time browsing source code. For this, check out <a href="http://lxr.linux.no/" rel="noreferrer">http://lxr.linux.no/</a> which is a browsable linked version of the source and makes life a lot easier. For the very first version of Linux (0.01) check out <a href="http://lxr.linux.no/linux-old+v0.01/" rel="noreferrer">http://lxr.linux.no/linux-old+v0.01/</a>. The fun begins at <a href="http://lxr.linux.no/linux-old+v0.01/boot/boot.s" rel="noreferrer">http://lxr.linux.no/linux-old+v0.01/boot/boot.s</a>. As you progress from version to version, check out the ChangeLog and dig into those parts that have changed to save you re-reading the whole thing again.</p>\n\n<p>Once you\'ve gotten a hold of the concepts, look at 2.0, then 2.2, etc. Be prepared to sink A LOT of time into the process.</p>\n'}, {'answer_id': 24794, 'author': 'Chris B-C', 'author_id': 1517, 'author_profile': 'https://Stackoverflow.com/users/1517', 'pm_score': 0, 'selected': False, 'text': '<p>When I was at uni I spent a semester studying operating systems, and as part of this had an assignment where we had to implement a RAM-based filesystem in Linux.</p>\n\n<p>It was a fantastic way to get to understand the internals of the Linux keurnel and to get a grasp on how everything fits together - And a heck of a lot of fun playing around with how it interacts with standard tools too.</p>\n'}, {'answer_id': 24803, 'author': 'Joe Shaw', 'author_id': 156, 'author_profile': 'https://Stackoverflow.com/users/156', 'pm_score': 1, 'selected': False, 'text': '<p>There\'s no substitute for diving into the code.  Try to find a driver or subsystem that you\'re interested in and poke around with it.  With tools like <a href="http://vmware.com/workstation" rel="nofollow noreferrer">VMware Workstation</a> it\'s super easy to make whatever changes you want, snapshot the VM, and run your modified kernel.  If the kernel panics on boot, who cares?  Just jump back to the snapshot and fix the problem.</p>\n\n<p>For books, I strongly recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0672327201" rel="nofollow noreferrer" rel="nofollow noreferrer">Linux Kernel Development</a> by Robert Love.  It\'s a wonderfully written book -- lots of information, organized sanely, and humorous... not dry reading at all.</p>\n'}, {'answer_id': 25082, 'author': 'Andrew', 'author_id': 2682, 'author_profile': 'https://Stackoverflow.com/users/2682', 'pm_score': 0, 'selected': False, 'text': "<p>I haven't tried it myself, but you can go to Linux From Scratch and start building your own Linux distribution. Sounds like something that'll take a junkload of time, but will result in an intimate knowledge of the guts of the  Linux kernel and how each part works. Of course, you can supplement this learning by following any of the other tips here.</p>\n"}, {'answer_id': 25105, 'author': 'Henrik Gustafsson', 'author_id': 2010, 'author_profile': 'https://Stackoverflow.com/users/2010', 'pm_score': 2, 'selected': False, 'text': '<p>Noting the lack of BSDs here, I figured I\'d chip in:</p>\n\n<ul>\n<li><a href="https://rads.stackoverflow.com/amzn/click/com/0201702452" rel="nofollow noreferrer" rel="nofollow noreferrer">The Design and Implementation of the FreeBSD Operating System</a> (dead-tree book)</li>\n<li><a href="http://www.mckusick.com/courses/index.html" rel="nofollow noreferrer">Unix and BSD Courses</a> (courses and videos)</li>\n<li><a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/index.html" rel="nofollow noreferrer">FreeBSD Architecture Handbook</a> (online book)</li>\n</ul>\n\n<p>I haven\'t taken any of the courses myself, but I\'ve heard Marshall Kirk McKusick speak on other occasions, and he is really good at what he does. </p>\n\n<p>And of course the BSD man pages, which are an excellent resource as they are maintained to a far greater extent than your average Linux man-page. Take for instance the <a href="http://man.openbsd.org/OpenBSD-current/man9/uvm.9" rel="nofollow noreferrer">uvm(9)</a> man-page, describing the virtual memory interface in OpenBSD.</p>\n\n<p>Not quite related, but I\'ll also recommend the video <a href="http://www.mckusick.com/history/index.html" rel="nofollow noreferrer">History of the Berkeley Software Distributions</a> as it gives a nice introduction to the BSD parts of the UNIX history and culture as well as plenty of hilarious anectodes from back when.</p>\n'}, {'answer_id': 25702, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 1, 'selected': False, 'text': "<p>Take Mike Stone's advice and start with Minix.  That's what Linus did!  The textbook is really well written, and Tannenbaum does a great job of showing how the various features are implemented in a real system.</p>\n"}, {'answer_id': 221799, 'author': 'Draemon', 'author_id': 26334, 'author_profile': 'https://Stackoverflow.com/users/26334', 'pm_score': 1, 'selected': False, 'text': "<p>Nobody seems to have mentioned that code-wise BSD is much cleaner and more consistent. The documentation's way better too (as already mentioned). But since there's a whole lot of fiddling with whatever system you choose - I'd pick the one you use more often.</p>\n"}, {'answer_id': 2722781, 'author': 'SystematicFrank', 'author_id': 253098, 'author_profile': 'https://Stackoverflow.com/users/253098', 'pm_score': 2, 'selected': False, 'text': '<p>I recommend you the BSD kernels! BSD kernels have far fewer hackers so following their evolution is easier. Either BSD and Linux kernels have great hackers, but some people argue that BSD lower fame filters out novice ones. Also taking design decisions is easier when the sources are not being updated 100 times a day.</p>\n\n<p>Among the BSD choices, my favorite one is NetBSD. It might not be the pain-free choice you want for your desktop, but because it has a strong focus on portability, the quality is quite good. I think this part say it all:</p>\n\n<blockquote>\n  <p><em>Some systems seem to have the philosophy of “If it works, it\'s right”. In that light NetBSD\'s philosophy could be described as “It doesn\'t work unless it\'s right”</em></p>\n</blockquote>\n\n<p>If you have been working long enough, you will know that NetBSD is a quite joy for learning good coding. Although professionally you will find more chances with Linux</p>\n\n<p>Whichever choice you take, start joining their mail lists, follow the discussions. Study some patches and finally try to do your own bug-fixing. Regarding books, search for Diomidis Spinellis articles and <a href="http://www.spinellis.gr/codereading/" rel="nofollow noreferrer">his book</a>. It is not exactly a kernel book, but has NetBSD examples and helps a lot to tackle large software.</p>\n'}, {'answer_id': 9113164, 'author': 'psihodelia', 'author_id': 215571, 'author_profile': 'https://Stackoverflow.com/users/215571', 'pm_score': 1, 'selected': False, 'text': '<p>Linux and Minix are fun to learn. If you also want to learn how a modern micro-kernel operating system looks like, you can look at QNX. The complete documentation is available online and it is very accessible. For example, <a href="http://www.swd.de/documents/manuals/sysarch/index_en.html" rel="nofollow">this</a> online book.</p>\n'}]
['https://Stackoverflow.com/questions/24648', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1534/']