Analysis on kernel source code of Linux system

Source: Internet
Author: User

One of the biggest benefits of Linux is that its source code is open. At the same time, the open core source is also attracting countless computer enthusiasts and programmers, they read and analyze the core source of Linux as their greatest interest, to modify the Linux source code and transform the Linux system as their pursuit of computer technology's biggest goal.

Linux kernel source code is very attractive, especially when you understand an analysis of a long time did not understand the problem, or you have been modified by the kernel, smoothly through the compilation, all the time the normal operation. What a sense of accomplishment! Moreover, the analysis of the kernel, in addition to the fanatical pursuit of technology, the rewards of this daunting labor are also fascinating, which is the main reason for its many followers:

First of all, you can learn a lot of the bottom of the computer knowledge, such as the following will be referred to the system guidance and hardware provided by the interrupt mechanism, and other, like the implementation of virtual storage mechanism, multi-task mechanism, system protection mechanisms, etc., these are not the source code can not understand.

At the same time, you will also be from the overall structure of the operating system, realize the overall design in the software design of the weight and role, as well as a number of macro-design methods and techniques: The Linux kernel for the upper application to provide a specific hardware-related platform, while inside the kernel, it also divides the code into the architecture and hardware-related parts, and portable parts; Linux, for example, is not a microkernel, but he processes most device drivers into relatively independent kernel modules, reducing the overhead of kernel operation and enhancing the module independence of kernel code.

And you can also from the analysis of the kernel source, realize that it solves a specific detail problem, the method is ingenious: such as the analysis of Linux through the botoom_half mechanism to speed up the system to interrupt processing.

The most important thing is: in the source analysis process, you will be 1.1 points, imperceptible specialization. A professional programmer, always put the code clarity, compatibility, portability in a very important position. They always define a large number of macros to enhance the clarity and readability of the code without increasing the length of the compiled code and the efficiency of the code, and they always take into account future code maintenance and upgrades while coding. Even if you analyze 1% of the code, you will be deeply aware of what kind of code is written by a professional programmer, what kind of code is written by a hobbyist. This is something that no one who has really analyzed standard code can understand.

However, because of the lengthy kernel code and the complexity of the kernel architecture, parsing the kernel is a difficult and demanding thing, especially in the absence of guidance and communication. Only the correct method, can be more effective. It is based on this consideration, the author hopes that this article can give us some reference and enlightenment.

Since my analysis is based on the 2.2.5 version of the kernel, if not specifically, the following analysis is based on the i386 single processor version of the Linux kernel 2.2.5. All source files are relative to the directory/usr/src/linux.

To analyze the Linux kernel source, you must first find the location of each module, it is necessary to understand the source document organization. Although this is not difficult for experienced masters, it is necessary for many junior Linux enthusiasts and those who are interested in source analytics but have little contact with them.

1, Linux core source program is usually installed under the/usr/src/linux, and it has a very simple numbering convention: The core of any even number (two numbers are even, 2.0.30, for example, is the core of a stable distribution, and any odd-numbered core (such as 2.1.42) is a developing core.

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.