12

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

gnat
  • 21,442
  • 29
  • 112
  • 288

5 Answers5

12

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.

Maglob
  • 3,839
  • 1
  • 24
  • 27
4

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

Mahmoud Hossam
  • 3,817
  • 2
  • 29
  • 41
3

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.

Martijn Pieters
  • 14,499
  • 10
  • 57
  • 58
2

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.

Anthony
  • 900
  • 11
  • 17
0

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.

LennyProgrammers
  • 5,649
  • 24
  • 37