Design and Implementation of Linux kernel version 2;

Source: Internet
Author: User
The Design and Implementation of the Linux kernel version 2-Linux general technology-Linux programming and kernel information. The following is a detailed description. BY albcamus
Robert Love's book Linux Kernel Development is suitable for getting started with the Kernel. In addition, some explanations, such as the lower half, are in place. Thanks to the help of a strange friend, I was lucky enough to get the second English version of this book. I made a correction against the English version in terms of poor understanding of Chinese. Only correction is difficult to understand. Of course, some errors may be caused by my understanding. Thank you.

L + 7 indicates 7th rows from top down; L-7 indicates 7th rows from bottom up.

P8

L + 7: The inline function is usually defined in the header file in the exercise.

Correction: in practice, inline functions are generally defined in header files.

P9

L-13: Linux kernel supports multi-processor concurrent processing

Correction: The original article is "The Linux Kernel supports multiprocessing". It seems better to translate it into "Linux Kernel supports multi-processor systems", and it cannot be said as concurrent or parallel)

P31

L + 9: each priority array also contains a queue called struct list_head.

Correction: translation error. Original article: "Each priority_array also contains an array named queue of struct list_head queues. each priority_array contains an array called queue. Each element of this array is a struct list_head queue ". In fact, this can also be seen from the structure definition of priority_array on the Left page.

P51

L + 1: press the system call number and parameters into the register and start soft interrupt to fall into the kernel.

Correction: it should be "triggering software interruption". The original Article is software interrupt rather than softirq. This is not the same as softirq as a lower half mechanism.

P61

L-4: first, because the processor prohibits interruption, to open them here, you must specify the SA_INTERRUPT flag during Handler Registration.

Correction: "required" should be changed to "no ". If the SA_INTERRUPT flag is specified during registration, can it be enabled here? Obviously not. The translator misunderstood the meaning of the original work.

P63

L-17: cli and sti are assembly instructions for the clear and set allow interrupt (allow interrupts) Flag, respectively

Correction: the translation is really awkward. Changed to "cli and sti call the Assembly commands that allow the clear and set operations of the interrupt mark respectively ." (It seems as awkward)

P73

Correction: in this section, all the words "pending" are in the original version of pending, meaning pending, unprocessed, and pending. Anyone who has used UNIX signals knows that, pending and suincluded do not mean anything at all.

P87
This is correct. I am wrong. Thank you for your correction.

P116

Section 9.2

Correction: the layout is too irresponsible. As the countdown HZ Variable of the beat, all are printed into Hz, as if the frequency unit was HZ. Change it by yourself.

P155

L + 8: struct super_operations s_op;

Corrected: struct super_operations * s_op; the original book was printed incorrectly. (Don't underestimate this star. VFS's object-oriented model depends on it)


P170

L + 4: three data structures closely link the VFS layer and file Processes

Correction: the word "file" does not know where it comes from. The original book does not exist.


P175

L + 10 ~ L + 11: You can ; To find the bh_state_bite list containing all valid flag.

Correction: incorrect translation. Original article: The legal flags are stored in the bh_state_bits enumeration, which is defined in ;. In fact, we can see the first four letters of enumeration as an enumeration, and change it to: "valid signs are stored in the bh_state_bits enumeration. ."


P176

L-3: struct bio_vec * bi_io_vecs

Correct: struct bio_vec * bi_io_vec. The text on the next page 2-2 and commentary are printed incorrectly.


P191

L-11: Remember that the root node is always red.

Correction: How does this conflict with the data structure I have read. Mark Allen Weiss's "data structure and algorithm analysis-C language description" Chapter 2nd chapter 12th "advanced data structure and implementation" said: "The root is always black ." (P.S. weiss is a teacher of Robert Love. In fact, the words of Love are self-contradictory. He said: "(red and black) the rule for assigning is: 1) the child node of the red node is black, and 2) any path from node to leaf in the tree must contain the same number of black nodes. Remember that the root node is always red ." We can make a counterevidence. If the root node is red, consider a binary tree with only two nodes. Since the root node is red, according to the first rule in Love, the leaf node must be black, this causes the number of black nodes in the path from the root node to the left and right of the NULL pointer to be different (0 on the left and 1 on the right), which is in conflict with the second rule. Love is a mathematics major at the University of Florida. It is impossible to make such a mistake, either printing or understanding.


P237

L + 1: If you want to obtain a separate file

Correction: the original article is "If you need to diff only a single file". It is obvious that the input of the diff program is two single files (instead of two directories ), it does not mean that diff generates a single patch file. (Besides, can the diff program generate more than one file? I'm skeptical)

Okay, so much. Other things do not affect reading. Happy Reading !!


Supplement:

When I translated the document and found that some knowledge was not in place, I reread it and found several errors. Here:

P246, B .1.2,
Original book: its prototype is ; Medium:
Void * kmalloc_percpu (size_t size, int flags );
Void kfree (const void *);
Errata: note that the first line has a serious printing error. Correct the first line to the following two rows:
Void * alloc_percpu (type );
Void * _ alloc_percpu (size_t size, size_t align );

P246, L-5
Original book: The function kfree_percpu () will return an indirect reference pointing to the dynamically generated single CPU data.
Errata: "function kfree_percpu ()" is corrected to "function alloc_percpu () or _ alloc_percpu ()".

Above P111, "8.9 forbidden preemption"
Original book: as long as there are no other writers, write locks can always be obtained successfully. The reader will not affect the write lock, which is the same as the reader-writer spin lock and semaphore.
Errata: the translator understands the error. The original English version of this book is "The write lock always succeeds in being obtained so long as there are no other writers. readers do not affect the write lock, as in the case with reader-writer spin locks. "This sentence means that if you want to apply a write lock to a lock such as seqlock, as long as there is no other write lock at this time, no matter whether there are or how many read locks attached to it, you will all lock successfully. This is different from the read/write locks and read/write semaphores. When there is a read lock, the write lock cannot be successful. It will make the caller spin it until all the write locks are released. In fact, this knowledge can also be proven in P104 and P108's explanation of read/write locks and read/write semaphores. Therefore, this sentence is corrected as follows: "As long as there are no other writers, obtaining the write lock will always be successful. The reader does not affect the write lock as the read/write lock and the read/write semaphore ."

P109, "8.7 BKL" the above section describes "completion variable"
Original book: the common way to complete a variable is to use the completed variable as a dynamic creation in the data structure, and the Code for completing the preliminary test of the data structure will call wait_for_completion () for waiting.
Errata: the translator understands the error. The original English version of this book is "Kernel code waiting for the initialization of the data structure cballs wait_for_completion (). when the initialization is complete, the waiting tasks ared awakened via a call to completion (). "Translation corrected:" The kernel code waiting for the data structure to be initially tested calls the wait_for_completion () function to wait. After the preliminary test is completed, the thread executing the preliminary test will call completion () function to wake up all pending tasks."

P74, the line above "2. Scheduling tasklets"
Original book: tasklets is activated and can be executed only when it is set to suspended.
Errata: the original "if marked pending" is "if marked pending", and the more accurate translation is "marked as pending ". Repeat it again. The original English texts of all the pending words in this chapter are pending, meaning unprocessed, pending, and pending. You can make the corresponding changes on your own.

Another mistake is that the data structure of the Radix Tree is not a binary Tree. However, as mentioned in the book, both Chinese and English are wrong.
Related Article

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.