Buffer in the file system is often used to ease the CPU read and write memory and read and write disk speed. For example, a process A data sent to another process B, process A need to process the data processing and B to write the file, if the B does not handle, then A to delay the transmission. In order to ensure that the process of A to reduce the waiting time, you can use a buffer between A and A, B each time the data is stored in the buffer, B buffer in each buffer. This is a typical producer and consumer model, the buffer data to meet the FIFO characteristics, so you can use the queue for real...
1 linked list and hash table
Linked list can be discrete time to arrive at the data structure string together, so that it can be more easily index. Linux kernel in all the use of two-way linked list. Then why the list should be put together with the hash table to introduce it? Because the hash table roommate list group consisting of each hash bucket is a list. The Linux kernel in all the use of two-way linked list, this list in the application to the hash table to be targeted for optimization.
1.1 two-way linked list
A two-way list is easy to make a ring, the starting prev is set to the last data, the last data n...
Kernel data structure
To be added
To be added
Two-way linked list
To be added
No chain table
To be added
Tree as a very common data structure, including the two fork search (BST), multi search tree (B- tree), B tree according to the leaf node tree is divided into two fork tree and multi tree. According to whether the node is highly symmetrical, balanced tree and non balanced tree, balanced tree of a hollow tree or it's about two subtrees height difference absolute value less than 1, and about two sub tree is a balanced tree. Simple to say is about the same height.
Want to study the Linux kernel, using the Linux kernel, the first to know what Linux kernel can do, what to provide. I have seen a lot of beginners into the company began to use the kernel module Linux kernel development, the use of either the communication mode, the memory interface or the device interface is still the kernel has been eliminated. The reason is that they are usually directly on the network to search for how to finish the work. But they are in the hands of the most advanced kernel code.
A large part of the programmer is that they can conquer all the people. A little look at Baidu will be able to use. I not...
The earliest kernel packet filtering mechanism is ipfwadm, then ipchains, then it is iptables/netfilter. In the future, that is, it is now nftables. But nftables and iptables also participate in the stage, who can win is still inconclusive. But they all belong to the sub members of the Netfilter project. Hook Netfilter based on hook, in several fixed position by the Netfilter kernel network stack hook. We know the data...
Overview LSF (Linux socket filter) originated in BPF (Berkeley packet filter), based from the schema consistent, but the use of more simple. LSF internal BPF is the first cBPF (Classic) and later X86 platform first switch to eBPF (Extended), but because many of the upper applications still use cBPF (tcpdump, iptables), and eBPF also did not support many platforms, so the kernel provides the away from cBPF towards eBPF...
Linux from UNIX and POSIX where inherited the most basic security mechanisms: the user, the file permissions, the process capabilities. But only these are not enough, a lot of third parties to achieve a new mechanism, through the form of patches to provide. Such as security enhanced Linux (SELinux), domain and type enhancement (DTE), as well as the Linux intrusion detection system (LIDS), etc., but not which completely win, so they do not have access to the main kernel code.
Linux founder Linus Torvalds agreed with Linu kernel...
Number theory, encryption, password application, the three end is which needs to appear before the elegant meaningless. But the number is the basis of the encryption algorithm, encryption algorithm is the basis of application of the password. We can cut the application from number theory, also from the application to find the number of support. The former is the train of thought of mathematics, the latter is the idea of normal people. I am a normal person.
There are three main applications: abstract, encryption and authentication.
Abstract is to a large section of the data generated a length shorter data. The data can represent the data and usually will not repeat. Main use in download or pass...
Linux kernel network: TCPTCP Engineering - causes TCP hopes to reach a data sequence, transmission loss.
TCP this Agreement as long as there is demand, there is the problem. The problem is that, since we want to ensure that in order to arrive and fully arrived, how to ensure that? Not only to ensure that, but also to ensure speed, but also how to design the mechanism? The final design of the mechanism of the TCP designer is ARQ, is to send a few packets, the other side to confirm. The confirmation is the flow, rather than the packet, which is also in line with the original intention of TCP design. Data packets used in many protocols...
This article is reproduced and assembled, but think that these knowledge should be put together better. Most of process system resource use principle process by glibc application memory usage, but glibc is an application program library, it is ultimately to calls to the operating system memory management interface to use memory. In most cases, glibc is transparent to the user and the operating system, so the process of recording the operating system directly is a great help to the memory usage. But glibc own implementation is also a problem, so too special circumstances to be held in the process of investigating the memory...
Process and service process is to meet user needs a series of tasks, some in order to provide an interactive interface, some in order to provide a background of calculus, some in order to provide a network service, some in order to use disk resources for storage. In the final analysis, the process is the demand of the bearer. PC itself is universal equipment, all of the natural PC system to meet a variety of needs, so providing an intuitive process model is the basis for a variety of services. In kinds of users may be strange, some services in the health, some service for the entertainment of the film, some service in the game. These programs...
The outer overview is 3 files: socket, compat, sysctl_net. Socket file defines the system operation storm drain to the user program interface, compat is compatibility to consider the special socket interface services (mainly in SPARC), sysctl net to the kernel sysctl interface registration service (with and without a specific node, specific achieve in each internal module). The most important directory is the core folder, the interior is part of the whole frame based net...
Facing the traditional web server problem, we know the traditional web server, a process opens the socket, listening to the request to generate a new process (or thread, or obstruction) response, itself still continue to monitor. This is seen in the unix network programming of the majority of people have access to the network model. However, UNIX is too old, the network needs in recent years has been a huge change, the most important is the requirement for concurrency. The improvement of the concurrency requirements, so that the machine's server web architecture also changed, and the words of this machine also...
The software industry is experiencing a revolution, the beginning of virtualization and cloud is an independent development, but with the development of in-depth, more and more needs of the cloud virtualization provides a stable working environment and scalable characteristics. Virtualization also increasingly requires the cloud to expand its scale. In this process of integration, Linux also followed the introduction of a lot of features to adapt to the changes in the industry. Distributed file system overlayFs virtual file system on the same computer with a number of processes using the same operating system, to see the common directory structure. When the process becomes a cloud process, because it is not put on the computer to perform,...
C and C++ compared to countless people said, said C efficiency is high, but a lot of people have done experiments if the RTTI does not apply to C++, C++ efficiency will not be too low (about 25%). There are people who say that the powerful STL C++, but the point of the efficiency of the words that really can not be used, I said behind the specific. General most people's state of mind, learn C + + background, often Tucao linux c code chaotic mess, the various agile, object-oriented principles, to streamline the code than C + +, even a STL or boost are not used, such as software engineering related problems are be the hardest hit them Tucao...
Linux kernel generic technology
Linux kernel techniques and tools
Linux kernel on the lower level communication
Defines an interface that contains a variety of function pointers, and manage the list. The lower layer by generating a structure like this, the operator will be assigned to the corresponding domain of the structure, and then call the upper layer of the registration function, the information will be registered to the upper. In this case, the upper layer can call different lower level interfaces with a unified function. The upper level can be traversed, or by name, or set to determine which of the lower structure corresponding to the same name. ...
USB kernel driver layer
First USB (UniversalSerial bus) is a transport protocol, and is not a protocol, nor any semantic instruction significance. The SCSI command transmitted by the USB transport protocol is a command that is understood by all storage devices, and the USB's responsibility is to serve these commands and return the data requested by the command. So, USB transport protocol is not to know the SCSI directive, it is the task of the upper layer of any data to USB transmission mode.
USB background knowledge...
Universal block abstraction
Block layer located in the SCSI upper, lower file system, system main memory management and read / write optimization are done here. DIRECT_IO is skipping this layer. This layer is not driven, but a mechanism. The code is located in the linux/block folder, is a separate out of the.
We do not look at the code, analyze the layer needs what components.
L on disk and partition of abstract genhd.c Abstract: partition-generi...
BDI: cache device
BDI to block device layer memory support and related code page in the mm directory. BDI full name is device info backing, backup device is non-volatile memory, but the memory is relatively slow, so the need to cache. BDI corresponding structure is backing_dev_info, the work of this module is to complete the work of each BDI device for its write operations to be cached, and then the appropriate time to write to the BDI device. Note that each disk is corresponding to the b...
File system layer
Types and selection of file system
There are many kinds of file system, Linux kernel is a hodgepodge, while meeting the needs of enterprises and individuals, the file system is also so, release is also so. One of the reasons for their analysis.
We that are most common in the Linux file system ext2, ext3, ext4, windows is NTFS, fat, and exFAT. These file systems can be seen in business users can also be seen in the individual user.
There is a rfkill subsystem in the kernel, which can be used to close any RF transceiver. Linux in the general framework of the sub system, each device is in fact the implementation of the function of the subsystem. These subsystems provide a complete interface to the operation of the same kind of functions. This is similar to the Interface concept for object oriented programming. ...
Audio equipment is very common, but it is most likely to be one of the problems in the Linux under the equipment. Audio device types and a wide variety of chips, so it must provide enough drive, and the kernel has enough power to drive and match the device. Because of the diversity, the kernel must provide a unified interface. So there's an audio frame.
Audio frame and other frames, the role is down to provide requirements, requirements for each audio driver must to realize the structure and function, to provide a unified operation, making the upper software only need to call the fixed operation function.
Kernel development cycle
You wrote the part of the kernel code to submit to the right time kernel is when the kernel with the window open, usually lasts for two weeks. After the release of the RC1 release, RC1 generally only to merge window, add the code were test and modify, without adding new function (new hardware drivers except). This change will continue to be based on the program to RC7 or even rc9, and finally released a stable version. Then open the merge window.
In the process of RC test and stability, resulting in more bug merger may be back to the new moon, and removed from the kernel, so before submitting to the kernel...
User level LXC
LxC is at the user level virtualization, the mechanism only uses the CGroup and namespace provided by the kernel, to create a space for the user to create a separate system. However, in essence, only the user to see the case, the kernel is a common one, and do not need to do the code conversion, but will be in the internal division of resources. ...