<story><title>Programs to Read</title><url>http://wiki.c2.com/?ProgramsToRead</url></story><parent_chain><item><author>lucaslee</author><text>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...&lt;p&gt;I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;CodeReaderMe&amp;#x2F;awesome-code-reading&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;CodeReaderMe&amp;#x2F;awesome-code-reading&lt;/a&gt;.</text></item></parent_chain><comment><author>stiff</author><text>Most of the kernel code is in the drivers, the general purpose subsystems (VFS, I&amp;#x2F;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.&lt;p&gt;Some ways you can start:&lt;p&gt;- Here is start_kernel(), the kernel entry point after booting up and handling the lowest level stuff in asm:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;init&amp;#x2F;main.c#L531&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;init&amp;#x2F;main.c#L53...&lt;/a&gt;&lt;p&gt;- grep for SYSCALL_DEFINE to find definitions of syscalls, e.g. this is open():
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;fs&amp;#x2F;open.c#L1076&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;fs&amp;#x2F;open.c#L1076&lt;/a&gt;&lt;p&gt;(understanding how the I&amp;#x2F;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)&lt;p&gt;- this is the struct that represents each process in the system, you can pick some interesting field and search for where it is used and where updated:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;include&amp;#x2F;linux&amp;#x2F;sched.h#L593&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;torvalds&amp;#x2F;linux&amp;#x2F;blob&amp;#x2F;v4.19&amp;#x2F;include&amp;#x2F;linux&amp;#x2F;s...&lt;/a&gt;&lt;p&gt;Finally, the linux-insides book is pretty helpful:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;0xax.gitbooks.io&amp;#x2F;linux-insides&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;0xax.gitbooks.io&amp;#x2F;linux-insides&amp;#x2F;&lt;/a&gt;</text></comment>
<story><title>Programs to Read</title><url>http://wiki.c2.com/?ProgramsToRead</url></story><parent_chain><item><author>lucaslee</author><text>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...&lt;p&gt;I think smaller projects are better for learning purposes. If you are interested in reading some smaller projects, check out my project here &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;CodeReaderMe&amp;#x2F;awesome-code-reading&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;CodeReaderMe&amp;#x2F;awesome-code-reading&lt;/a&gt;.</text></item></parent_chain><comment><author>ken</author><text>Nobody ever wrote a 25MLOC program from start to finish, so I don&amp;#x27;t think it makes much sense to read it that way.&lt;p&gt;I&amp;#x27;d read it the way it was written: from the beginning.  What&amp;#x27;s Linux 0.01 look like?  What&amp;#x27;s the next changeset after that release look like?  What was necessary to add the driver for your favorite device?  What changes were made for your particular CPU?&lt;p&gt;Programs are not static works (except maybe TeX and Metafont).  They exist in the form they do in order to be amenable to changes.  So look at the changes that drove it.</text></comment>