Linux kernel "Problem gate"-learning issues, experience highlights

Source: Internet
Author: User

The Chen Charter said: "The study of your doubts, small doubt small into, big doubt is big into." The suspect, the machine of consciousness, also, some enlightenment. ”

Bacon said: "More people will have more to ask." ”

Still in the school when the tutor in the speech after the passion of the room in the form of different but silent, we bitterly said: "It is important to ask questions, comrades!" Do not ask questions how to be qualified to do research! ”

Such a forceful admonition today reminds me that I still feel stimulated, so I will inevitably have to make some reaction. But one is because we have no non-mainstream in this era, the second is because there is no Feng classmate's gender advantage, can not be stimulated on the whole door. The biggest reaction we can do is to open a special discussion about the kernel learning problems, in order to slightly increase the advertising effect, it is called "Problem door" bar.

The use of the "problem door" of the name, one is hidden in the heart of the point of taste to dip in the various "door" in recent years, the second is in the core of the learning process is really real existence of such a "door", in front of us, across the sky is another world, But it is to let countless people competing bow down, think not its key.

In addition, this "problem door" is also a My book "Linux kernel cultivation of the road" produced a small episode, in order to thank the essence of the release process a lot of friends care and support, I hope through the core learning process encountered problems and experience to do a show to help friends still outside the door to find this door key.

I first put forward the most questions to answer, "to", as the "problem door" of the embryonic, we can also put forward their own problems in the comments and share their own learning experience, I will be in a timely manner to organize the summary, we will be "problem door" gradually improve, to help the later and the need to people no longer for " Getting Started "and distressed. your question may be included in my new book! I hope this is an article that can grow!

Raise your question, do not "accompany Childe to study", Wish the early "Introduction"!

. years 3 Month in Daily Update

" Problem Door " Section 6 back: Research the core source of the entry point where, or from which module to start research on the novice more suitable, whether there are some required to read the basic module source code? ( presented by Roger_jin)

FUDAN_ABC the answer:

Do not have those so-called must read the basic source code, hehe, as long as the Han Feng comrade's attitude to analyze the selected parts of the source code, those so-called basic stuff will be in the analysis process understand. With contextual help, it is easier to understand the "basics" that were not previously understood.

As for the entry point, there is no special recommendation, mainly rely on their own interests or development needs.

March 24, 2010 Update

"Problem Gate" 5th: Learn the Linux kernel, which version of Linux should start reading better?

FUDAN_ABC's Answer:

Personal suggestions start from the new kernel, although the code of the kernel is very large, but does not say that the non-perfection, the pursuit of each part of the understanding.

Learn the kernel taboo seek chatty, if to which part is more interested in, study the source code and change on the line, of course, the benevolent see, oneself if feel from the lower version start better more suitable, that way also can not, after all the road of each individual walk.

March 23, 2010 Update

"Problem Gate" 3rd: Usually, the language and its library learning are divided into several levels, 1. Skilled use, 2. Read the source code, understand the principle of implementation, 3. Expand the source code. So how does the Linux kernel hierarchy, and how are each level achieved? (Presented by Hust_tulip)

FUDAN_ABC's Answer:

The three levels of the problem correspond to the learning of the Linux kernel: "Skilled use" is to be able to use the Linux system skillfully, "reading source" means "learning the kernel is learning the kernel source code", must be brave to learn the kernel of the source; "Extend the source" can correspond to the integration of the kernel community, Participate in the development of the kernel.

And that's just to some extent, wedge. The preface of this book is divided into several levels of kernel learning: a comprehensive understanding of grasping the basic, interest-oriented deep research, integration into the community to contribute, adhere to adhere to.

--See the preface to the course of cultivation

"Problem Gate" 4th: What are the corresponding references and network resources for each level of learning? (Presented by Hust_tulip)

FUDAN_ABC's Answer:

The first is "a comprehensive understanding of the basic", this level, the best book is naturally LKD and Ulk, these two books, a sketchy, a comprehensive in-depth, can be very good to help a comprehensive understanding of the overall mechanism of the kernel. New words, a copy of the LKD is also sufficient.

The second level of "interest-oriented deep study", this level is to core source code as the center, choose a kernel of their own interest in the attitude of Han Feng comrade to the diary, rigorous and meticulous careful analysis of its code, do not understand the place through the community, Mailing list or send email directly to maintainer to understand the way, do not muddle through. As for this level of reference books, network subsystem has "in-depth understanding of Linux Network Insider", Memory management has "in-depth understanding of Linux virtual memory management," recommended to see English version, hehe, USB can see our "Linux those things", other subsystems have not noticed what special explanation , but the kernel source code itself is the best reference.

As for the third level, "to contribute to the community" is to strive to integrate into the core development community, through the first two levels of cultivation, at this time you are no longer the role of diving in the community, but will be a problem to express their own views. You can try to participate in the development of the kernel. There are a lot of related resources, in detail can refer to the essence of the course of cultivation (9) Kernel Learning Resources

The last layer is to insist, no matter what setbacks are not to give up, like our Professor Yuan, regardless of what kind of abuse you have to adhere to the constant madness, there is such a spirit, what worry in the Linux kernel on the learning path can not be repaired avenue that?

March 22, 2010 Update

"Problem Gate" 1th: I am a beginner, two eyes a smear, how should I learn the kernel?

FUDAN_ABC's Answer:

This question every beginner cannot avoid, it is very big, can be completely as the whole "problem door" framework, the other problems are only in this framework decorate and perfect.

At the same time, this problem does not have a standard answer, only some of the context of learning can be followed, I wish an early "introduction."

The first step: you'll use it first. Even Linux is nothing, the basic operation will not be to study the kernel, purely nonsense, "the door" is not.

The second step: to understand the kernel source code needs some operating systems, C language and other basic.

The third step: find a suitable kernel reference book, let it help you have a whole understanding and understanding of the kernel,

Fourth step: To be able to manually configure the compilation kernel, but also basic understanding of the kernel Kconfig and makefile files.

Finally, remember: "Learning the kernel, is to learn the kernel source code, any kernel-related books are based on the kernel, but not higher than the kernel." The kernel source code itself is the best reference, any other classic or non-classic book at most just play an auxiliary role, can not and should not replace the kernel in our learning process of the dominant position. ”

So you have to choose a part of the kernel or subsystem, in order to Han Feng the attitude of comrade to the diary, rigorous and meticulous understanding of the implementation of each piece of code, ask more want to remember more. Do not hold a glance, muddle-through attitude.

"Problem Gate" 2nd: What basic knowledge is needed to learn the kernel?

Albcamus's Answer:

(1) need to master the initial level of knowledge of operating system theory.

There is no need to read through and understand the "operating system concept" "Modern operating System" and other masterpieces, but always know what the difference between ticks (time-shared) and real-time (real-time), the process is what, the CPU and the system bus, memory relationship (very rough), and so on.

(2) proficiency in C language.

Do not have to be proficient in C language, as long as you can skillfully write C programs, can understand the chain list, hash table and other data structure of the C implementation, using the GCC compiler, you can. Of course, if already proficient in C language is obviously a big advantage.

(3) Understand the knowledge of the CPU,

Linux Kernel learning Experience

1. The psychological misunderstanding of kernel learning

Psychological problems are mainly two, one is blind, is to be proficient in the use of Linux, the Linux for what also can not say a word, it is eager to blindly study the source code of the kernel. Repeat Linus's sentence: use it first.

The second one is fear. Human evolution so many years, the face of complex objects and things will always have a natural fear, embodied in the core learning is: so large and complex kernel code, let people face up to the situation why AH!

With this fear of powerlessness, psychological will be to exclude the face of contact with the kernel source code, preferring to hold the scene analysis, collect a variety of various kinds of kernel books in there tun, read and forget, forget and see, also reluctant to seriously carefully to browse the source code.
--See the essence of the course of cultivation (9) Psychological problems of kernel learning

2. The learning kernel is the source code of the Learning kernel

Learning the kernel, is to learn the kernel source code, any kernel-related books are based on the kernel, but not higher than the kernel. The kernel source code itself is the best reference, any other classic or non-classic book at most just play an auxiliary role, can not and should not replace the kernel in our learning process of the dominant position.

3. To carry out rigorous and meticulous analysis of the kernel source code

Since you want to learn the kernel source code, it is necessary to analyze the kernel, and the kernel code thousands, but also fought constantly to Riga, which makes most people have a mirrors of the helpless feeling of flowers. But do not be afraid, Confucius long ago left us the strategy: sensitive to things and cautious in words, the Youdao and is Yan, can be studious also has. That is to say, work to be steadfast is good student good comrade, must follow rigorous attitude, to understand each piece of code implementation, ask more want to remember more. If you hold a glance, muddle-through attitude, the result is likely to be one side to lose, not much harvest.

As long as you use this attitude to start analyzing the kernel, then no matter what part of the kernel you choose as a pointcut, such as USB, such as process management, after spending a relatively high amount of time, you will find that your understanding of the kernel will rise to another height, a hold the scene analysis, Holding the 0.1 kernel fully annotated, holding a variety of core books over and over again and again to see many times and forget many times can not reach the height.
--See the essence of the course of cultivation (6) and the essence (7) How to analyze the kernel source code to start?

4. Locating the target code via Kconfig and Makefile

It's no exaggeration to say that kconfig and makefile are the two files we rely on when we browse the kernel code. Basically, there is a kconfig file and a makefile file underneath each directory in the Linux kernel. For a person who wants to see a glimmer of light in the code of the Linux kernel, it is not too important to put them in a position of importance.

Kconfig and Makefile are maps of the Linux kernel maze. Maps lead us to know a city, while Kconfig and makefile let us understand the structure under a kernel directory. Every time we browse kernel to find the piece of code that belongs to us, we should look at the two files in the directory first. Just like using maps to find a destination, we need to use kconfig and makefile to find the target code to be researched.
--See the essence of the course of cultivation (5) kernel map: Kconfig and Makefile

Linux kernel "Problem gate"-learning issues, experience highlights

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.