Live data from Hacker News

Programs to Read

wiki.c2.com

31–40 of 60 posts

Re: Programs to Read

#31
post #25

I saw the Linux kernel was recommended many times here, but how many people actually read it? Where do you even start? The Linux kernel has around 60,000 files and 25 million lines of code... I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here https://github.com/CodeReaderMe/awesome-code-reading .

Most of the kernel code is in the drivers, the general purpose subsystems (VFS, I/O scheduler, task schedulers, memory management etc.) are a small fraction of those 25 million LOC and largely independent of each other so it is not that hard to build some understanding of them. Some ways you can start: - Here is start_kernel(), the kernel entry point after booting up and handling the lowest level stuff in asm: https:…

> (understanding how the I/O and networking system calls work is quite helpful for application developers, even if you work in node.js, python or another high level language)

Being able to semi-quickly figure out how the kernel actually performs some I/O operations and what the exact semantics are is tremendously useful when working with low-level I/O applications (e.g. database-like applications).

Re: Programs to Read

#32

Knuth vs McIlroy's solutions for a Word Frequency programming challenge: http://www.leancrew.com/all-this/2011/12/more-shell-less-egg... Knuth's solution has its own elegance and interest including various efficiencies and from-scratch facilities. McIlroy's will make you wonder how much you're wasting in time and complexity.

[deleted]

Re: Programs to Read

#33

Question, where does one start, when planning to read the Linux kernel? There is so much code. I have read it, but randomly. I have read contents of net/ kernel. I have read the main method where it attempts to launch pid1 of /bin/bash, etc. Is there a really good place to start reading? For example how does Linux talk to the hard drive? What's the first thing that happens in the kernel?

Start skimming through the included documentation files. You don't have to do a thorough read, but the Documentation folder is structured in a way mirroring the organization of the kernel. They will help you to understand the structure, and you can get deeper understanding of the essential parts that way.

Once you have mental map of major areas of the kernel it will be easier to relate to the sourcetree.

There used to be a number of great books on fairly esoteric issues of the kernel (like, comprehensive explanations of network stack). However most of them seem to be stuck at 2.6 and are no longer very up to date.

Re: Programs to Read

#34
One claim that caught my eye: Tex being unbuggy because it's written in the Literate Programming style. I like LP but that's a big claim. Occam's razor suggests a more likely answer: it was written by Knuth! A great programmer, and also one who grew up programming non-interactively: http://ed-thelen.org/comp-hist/B5000-AlgolRWaychoff.html#7

Re: Programs to Read

#35

I saw the Linux kernel was recommended many times here, but how many people actually read it? Where do you even start? The Linux kernel has around 60,000 files and 25 million lines of code... I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here https://github.com/CodeReaderMe/awesome-code-reading .

I have found NTOS to be much better documented than Linux. For example,

https://github.com/markjandrews/wrk-v1.2/blob/master/base/nt...

Almost every line of code has comments.

Re: Programs to Read

#36

I saw the Linux kernel was recommended many times here, but how many people actually read it? Where do you even start? The Linux kernel has around 60,000 files and 25 million lines of code... I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here https://github.com/CodeReaderMe/awesome-code-reading .

Where do you start depends what you're after. You should start by defining questions, then by searching for existing documentation, then reading the header files and data structures, and then perhaps some code. Also read userspace counterparts of the interface you're studying if applicable.

Worked fine for me when getting into media subsystem to write camera and camera soc interface drivers.

Re: Programs to Read

#37
post #5

Earlier quoted context omitted.

Hi, for some reason you're shadowbanned? As a new account I find this really unusual. It's likely you might need to verify your email or something. I've vouched for this comment, which is why it appears. On Topic: there was a discussion a year ago about what the progress block is: https://github.com/WardCunningham/remodeling/issues/24 It seems that he's stuck with some files that are mixed-encoding and can't repair t…

Thank you very much. This is a new account, but I don't know why I'd be banned :/ And why would you be able to see it and not me? :( On Topic again: c2.com is great, I'd love if someone would take ownership and keep maintaining it.

If you are a registered user, in the FAQ

>In my profile, what does showdead do?

>If you turn it on, you'll see all the stories and comments that have been killed by software, moderators, or user flags.

This is what people refer to when they say shadow/hellbanned.

Re: Programs to Read

#38

I saw the Linux kernel was recommended many times here, but how many people actually read it? Where do you even start? The Linux kernel has around 60,000 files and 25 million lines of code... I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here https://github.com/CodeReaderMe/awesome-code-reading .

James Hague's recommendations [0] of classical programs are on my bucket list.

[0] https://prog21.dadgum.com/210.html

Re: Programs to Read

#40

I saw the Linux kernel was recommended many times here, but how many people actually read it? Where do you even start? The Linux kernel has around 60,000 files and 25 million lines of code... I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here https://github.com/CodeReaderMe/awesome-code-reading .

In my view, "reading the kernel" is not really a useful exercise. Source code isn't a book, and most code isn't really a pleasure to read by itself.

Instead I would suggest that you try to debug a problem, or try to understand what a particular syscall does rather that starting from init/main.c. If you have a goal in mind (trying to solve a problem or understand a specific aspect of the kernel) you are far more likely to get useful information out of the exercise.

Another useful hint is that you should just ignore the majority of code that looks alien. Linux uses a lot of macros and synchronisation primitives that you probably aren't familiar with (RCU for instance). It's much more useful to take note of the things you don't understand and just move on to the code code that you do understand. Most of the macros and synchronisation primitives are used all over the kernel so you're very likely to get to grips with them over time.

I really hope that bpftrace will make it easier for people to get into kernel debugging and thus have a nicer "in" to kernel development.

Post reply on HN