Understanding Linux Network Internals Section 1.2
时间:2006-01-24 来源:icedragon
1.2. Common Coding Patterns
Each networking feature, like any other kernel feature, is just one of the citizens inside the kernel. As such, it must make proper and fair use of memory, CPU, and all other shared resources. Most features are not written as standalone pieces of kernel code, but interact with other kernel components more or less heavily depending on the feature. They therefore try, as much as possible, to follow similar mechanisms to implement similar functionalities (there is no need to reinvent the wheel every time). 1.2. 通常的代码式样
每个网络特征, 像任何其他的内核特征,在内核只是普通的一分子。 同样地,它一定适当的合理利用内存,处理器,和所有的其他被共享的资源。 大多数的特征没被写成独立的内核代码, 但是或多或少与其他内核成份有互相依赖的特性。 因此他们尽可能多的尝试, 通过相似的机制实现相似的功能.(没有必要每次都重新启动wheel)
Some requirements are common to several kernel components, such as the need to allocate several instances of the same data structure type, the need to keep track of references to an instance of a data structure to avoid unsafe memory deallocations, etc. In the following subsections, we will view common ways in Linux to handle such requirements. I will also talk about common coding tricks that you may come across while browsing the kernel's code. 一些请求对一些内核构成, 像是需要是通常的分派相同的一些数据结构类型的例证, 需要掌握参考一个数据结构的类型例证的资讯,避免不安全的内存存储单元分配, 等等。在下面的一小部份中,我们将会看在 Linux 中的处理这样需求的常规作法。我也将会谈论些通常的代码窍门,是你浏览内核代码的时候可能遇到的。 This book uses subsystem as a loose term to describe a collection of files that implement a major set of featuressuch as IP or routingand that tend to be maintained by the same people and to change in lockstep. In the rest of the chapter, I'll also use the term kernel component to refer to these subsystems, because the conventions discussed here apply to most parts of the kernel, not just those involved in networking.
这本书使用子系统当做一个宽松的术语用一组主要的短片描述实现一个文件的收集,当IP或者路由容易被相同的人维护和在因循守旧中改变 。在本章其他部分,我将用术语内核构成。所以在章节的其它部分中,我也将使用术语内核构成来对应提及的这些子系统,因为惯例,这里讨论的适用于内核的大多数部份, 不仅仅在那些网络方面涉及了。
Each networking feature, like any other kernel feature, is just one of the citizens inside the kernel. As such, it must make proper and fair use of memory, CPU, and all other shared resources. Most features are not written as standalone pieces of kernel code, but interact with other kernel components more or less heavily depending on the feature. They therefore try, as much as possible, to follow similar mechanisms to implement similar functionalities (there is no need to reinvent the wheel every time). 1.2. 通常的代码式样
每个网络特征, 像任何其他的内核特征,在内核只是普通的一分子。 同样地,它一定适当的合理利用内存,处理器,和所有的其他被共享的资源。 大多数的特征没被写成独立的内核代码, 但是或多或少与其他内核成份有互相依赖的特性。 因此他们尽可能多的尝试, 通过相似的机制实现相似的功能.(没有必要每次都重新启动wheel)
Some requirements are common to several kernel components, such as the need to allocate several instances of the same data structure type, the need to keep track of references to an instance of a data structure to avoid unsafe memory deallocations, etc. In the following subsections, we will view common ways in Linux to handle such requirements. I will also talk about common coding tricks that you may come across while browsing the kernel's code. 一些请求对一些内核构成, 像是需要是通常的分派相同的一些数据结构类型的例证, 需要掌握参考一个数据结构的类型例证的资讯,避免不安全的内存存储单元分配, 等等。在下面的一小部份中,我们将会看在 Linux 中的处理这样需求的常规作法。我也将会谈论些通常的代码窍门,是你浏览内核代码的时候可能遇到的。 This book uses subsystem as a loose term to describe a collection of files that implement a major set of featuressuch as IP or routingand that tend to be maintained by the same people and to change in lockstep. In the rest of the chapter, I'll also use the term kernel component to refer to these subsystems, because the conventions discussed here apply to most parts of the kernel, not just those involved in networking.
这本书使用子系统当做一个宽松的术语用一组主要的短片描述实现一个文件的收集,当IP或者路由容易被相同的人维护和在因循守旧中改变 。在本章其他部分,我将用术语内核构成。所以在章节的其它部分中,我也将使用术语内核构成来对应提及的这些子系统,因为惯例,这里讨论的适用于内核的大多数部份, 不仅仅在那些网络方面涉及了。
相关阅读 更多 +
排行榜 更多 +