Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a student interested in working on Memory Management, particularly the page replacement component of the linux kernel.

What are the different guides that can help me to begin understanding the kernel source?

I have tried to read the book Understanding the Linux Virtual Memory Manager by Mel Gorman and Understanding the Linux Kernel by Cesati and Bovet, but they do not explain the flow of control through the code. They only end up explaining various data structures used and the work various functions perform. This makes the code more confusing.

My project deals with tweaking the page replacement algorithm in a mainstream kernel and analyse its performance for a set of workloads. Is there a flavor of the linux kernel that would be easier to understand (if not the linux-2.6.xx kernel)?


locked by World Engineer Aug 2 '13 at 12:45

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off-topic by gnat, MichaelT, Bart van Ingen Schenau, World Engineer Aug 2 '13 at 12:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Bart van Ingen Schenau, World Engineer
If this question can be reworded to fit the rules in the help center, please edit the question.

May i ask why you've chosen to do kernel programming, when you feel not easy with finding your way around complex code? – LennyProgrammers Feb 11 '11 at 9:56

The debugger option could be useful.

Some more things that can be done after building the kernel with the debugger option is to write some sample test applications calling various system calls which will invoke the kernel and you can traverse through one piece of kernel code at a time and understand it's implementation.


In the Operating Systems section of the article, What Every Computer Science Major Should Know, Matt Might recommended Linux Kernel Development by Love. Although this is an advanced topic, the book is very well written.


Focus on data structures. Understanding data structures is usually more important than code.

If you are only shown data structures but no code, you still get the big picture of the system.

Vice versa, if shown only code but not data structures, it's very hard to understand the system.

"I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships." -- Linus Torvalds

"Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious." -- Fred Brooks.

+1 for Fred Brooks' comment. – Michael K Feb 11 '11 at 15:24

One way to learn a complex code base is to run it in a debugger and see where things take you. For Linux there is the Linux Kernel Debugger.

I'm not sure this will work for someone who's still trying what to do with this gigantic piece of code, and how it does things – Mahmoud Hossam Feb 11 '11 at 10:00
I've done this approach with huge code bases. You need an entry point and an idea what to look for, though. – LennyProgrammers Feb 11 '11 at 10:20
Yes, that's what I meant, he needs to know what to look for first before debugging the kernel – Mahmoud Hossam Feb 11 '11 at 11:31

Kernel Newbies is pretty good, I guess

There are a lot of people with an interest in learning about how the kernel works, I think you might learn a thing or two there