Linux 2.6 kernel in the eyes of developers

xiaoxiao2021-03-06  101

Linux 2.6 kernel in the eyes of developers 2004-07-13 Li Qingming Zhang Jing Click: 48

Linux 2.6 kernel in the eyes of developers

The launch of the Linux 2.6 kernel, whether it is the mainstream of Linux in the server field, or promoting its promotion process in the field of desktop operating systems, will play an incapacitated role. Developers should invest in the new changes brought by the Linux 2.6 core as the application development from the deep level. The kernel is the core part of an operating system. It completes the most basic functions of the operating system, including process scheduling, disk management, device management, network management, etc., in fact, the current algorithm or method will directly affect the performance of the entire operating system. And even the performance of applications developed on this operating system in the future. So what characteristics in the new kernel need for developers need to pay special attention? Memory 1. To preemptivate memory and most other operating systems, the 2.6 version previous Linux kernel is not allowed to be scheduled by a system called and in a running state. This means that once there is a task in the system call is being executed, the task will control the processor until the end of the system call, regardless of the length of the processor time. This design is simple, but in many cases, some important tasks will be delayed during waiting for the system call. The memory in the 2.6 version can be preemptive. This will significantly reduce the delay of similar programs such as user interactive applications, multimedia applications. This feature is especially useful for real-time systems and embedded systems. The sewerous memory allows Linux 2.6 kernels with better response capabilities than in version 2.4 in the event. In order to achieve preemptive memory, the code in the LINUX 2.6 core is set, which means that the scheduler will stop running, and perform a higher priority process. During the system call, the Linux 2.6 core will check the seizure point timed to avoid unreasonable delay. In the inspection process, the scheduling process is likely to stop the current process to make another process run. Not all kernel code segments can be preempted. The user can lock the key portion of the kernel code, and it is not allowed to be preemptive. Lock ensures that the data structure and status of each CPU are always protected without being preemptive. 2. The development process of introducing a memory pool mechanism 2.6 kernel has introduced a memory pool to meet molten allocation in uninterrupted. Its thoughts are pre-allocated a memory pool and retain it when it is really needed. 3. Improve the virtual memory version 2.6 inner nuclear blending RIK VAN RIEL's R-MAP (Reverse Mapping, reverse mapping) technology, will significantly improve the performance of the virtual within a certain degree of load. When the Linux kernel works in a virtual memory mode, each virtual page corresponds to a physical page of the corresponding system memory. The address translation between the virtual page and the physical page is done by the hardware page table. But this "virtual to physical" page mapping does not always correspond, multiple virtual pages may point to the same physical page. In this case, the kernel wants to release a specific physical page, you must traverse all process page table logs to find references to this physical page, and the physical page can only be released when the reference number reaches 0. When the load is high, this will make virtual memory very slow. The reverse address mapping patch solves this problem by introducing a data structure called PTE_Chain in the structural page. However, this method has a pointer overhead problem. Each structure page in the system must have an additional, structure for PTE_Chain. A 256MB memory system has 64K physical pages, which requires 64kb * (Struct PTE_Chain) memory being allocated for PTE_Chain, which is a very considerable number. Despite this, R-MAP performance, especially high-load high-end systems, is still significantly improved relative to the virtual memory system of the 2.4 version of the kernel. 4. Improvement of shared memory For embedded system developers, embedded systems are often a device with multiple processors, such as telecommunications networks or large storage systems. Whether it is a balanced or loose multiprocessor, it is generally shared memory.

The equilibrium multifunction design makes all the processors have all the right to use, and the decisive factors that limit the use of memory are the efficiency of the process. The Linux 2.6 kernel provides a different way for multi-programs, namely NUMA (Non Uniform Memory Access). In this method, memory and processors are interconnected, but for each processor, some memory is "off", and some memory is "farther". This means that when the memory competition occurs, the "closer" processor has higher use rights to the nearby memory. The 2.6 version of the kernel provides a set of functions to define the topology between memory and processors. The scheduler can utilize this information to assign local memory for the task. This will reduce the bottleneck caused by memory competition and improve throughput. Driver 1. Improvement of interrupt routines 2.6 interrupt handler inside the interrupt handler has experienced many changes, but most of them have no effect on ordinary driver developers. However, there are still some important changes to affect the driver developer. In the 2.6 version of the kernel, the driver will return to IRQ_HANDLED if you want to issue an interrupt from one device, otherwise returns IRQ_NONE. This can help the IRQ layer of the kernel clearly identify which driver is being processed which particular interrupt. If an interrupt request is coming, it is not registered with the handler of that device, the kernel will ignore the interrupt from the device. 2. The driver transplantation relative to the 2.4 version of the core, the 2.6-teld nuclear improves the kernel compilation system to achieve faster compilation speed. The 2.6 version of the compilation system joins the improved graphical tool Make Xconfig (requires QT library) and make gconfig (requires GTK library). The kernel module loader is also fully implemented in version 2.6, so that the module compilation mechanism has a great difference with respect to the 2.4 version. The module tool in the original version 2.4 cannot be used to load or uninstall a module of the 2.6 version of the kernel, requiring a set of new module tools to complete the loading and uninstall of the module. This new module load tool will minimize the conflict of the corresponding module to be unloaded in the case where one device is still being used, but is confirmed that these modules have no devices in use and then unload. One of the reasons for producing this conflict is that the module usage is controlled by the module code. In the 2.6 version of the kernel, the module no longer needs to add the reference count, which will be external to the module code. Process Management 1. The new scheduler algorithm 2.6 version of the Linux kernel uses a new scheduler algorithm, called the O (1) algorithm, which is excellent in high loads, and can expand well when there are multiple processors . In the 2.4 version of the scheduler, the time slice is required to be re-calculated after all the processes are used in all the processes. In a multiprocessor system, it has to be waited for the process after the process has been used to obtain a new time piece, causing most of the processors to be idle, affecting the efficiency of SMP. In addition, when the idle processor begins to perform those processes that have not been exhausted, the process is in the process, it will result in "jumping" between the processor. When a high priority process or interactive process jumps, the performance of the entire system will be affected. The new scheduler solves the above problem is based on each CPU to distribute the time slice and cancel the global synchronization and the retrieval cycle. The scheduler uses two priority arrays, namely an active array, and an expired array that can be accessed by a pointer. The active array contains all the tasks that are missing to a CPU and have not been exhausted. The overcoming array contains an ordered list of all tasks that have been exhausted. If all active tasks have been exhausted, the pointer to these two arrays, including the expiration number of ready to run tasks into an active array, and an empty active array has a new array containing an expired task.

转载请注明原文地址:https://www.9cbs.com/read-104587.html

New Post(0)