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

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)?

share

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.

1  
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

5 Answers 5

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.

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

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

share

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.

share

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.

share

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.

share
    
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
1  
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