Linux Kernel interaction and responsiveness

Source: Internet
Author: User
Linux Kernel interaction and responsiveness-general Linux technology-Linux programming and kernel information. The following is a detailed description. In Linux 2.6, the focus is to make the system more responsive to desktop users and other applications that require highly manual control of events ). Different target systems have different challenges, but the kernel contains many changes, which will benefit them at the same time.

The main internal change that must be understood in section 2.6 is that the kernel itself can be preemptible. In all previous Linux versions, when the system runs kernel-related transactions, it cannot be interrupted (in a multi-processor system, this is also true from the cpu perspective ). In Linux 2.6, the kernel now allows itself to be interrupted when executing tasks, so that user tasks can continue to run even if the kernel is doing some complicated tasks. (To avoid obvious competition, the kernel contains some code segments with locks. When running such code segments, the kernel cannot be interrupted .) The main advantage of this change is that the system's interactivity (for example, for desktop users) is greatly improved, and the system feels much faster for user input events.

Other changes that make Linux a more responsive system are incorporated into support for the new "futexes" ("Fast User-Space Mutexes, this support function requires the support of User Programs (using futex for mutual exclusion ). Futexes is a mechanism for serialize events so that they do not conflict with each other. Unlike the mutex operations supported by most traditional thread library locks, this is partly kernel-based (partially kernel based ), at the same time, it also supports setting priorities so that applications or threads with higher priorities can preferentially obtain competing resources. By using a program to specify a waiting task, it is more important than other tasks, it may bring a time series of an application-better responsiveness in key areas.

The I/O subsystem of Linux has also undergone great changes, making it more responsive under various workloads. This change includes the I/O scheduling subsystem-deciding when and which process to read the kernel code of a device. The overwritten I/O layer can now better ensure that no process stays on the I/O wait for too long, at the same time, the previous optimization work is not excluded so that the read and other requests can operate on the hardware optimization work in the most effective order.

Although developers of Real-time Operating Systems (RTOS) can benefit from these changes, Linux 2.6 will not become a real-time kernel. However, these and other background work make it possible to turn Linux into RTOS. External patches that provide such support for users or developers (which have not been merged into the official kernel version) have already appeared.

Module subsystem-Device Driver

In the development process of Linux 2.6, the module subsystem is another significant improvement. Many codes are rewritten to improve stability and make the system more transparent. In addition to these obvious changes in the surface layer, there are also more kernel views and module usage changes.

First, the most obvious (though not significant) Change in the kernel driver in Linux 2.6 is the change in the file extension. ". Ko "(kernel object, the kernel target file) replaces ". o "(this is a common extension of a target file, which is usually created before links are generated during program compilation ). This makes the module not really an intermediate file much clearer, rather it is just a decorative (cosmetic) change.

The complete and substantial improvement lies in eliminating the competition among many kernel versions. The key to the problem is that, if the uninstallation occurs after the Module checks and confirms that no other device is using it, it is possible to start the device using an unmounted module. The new kernel module code should make this condition more difficult to trigger. Furthermore, it is also possible to simply prohibit the uninstallation of modules.

More transparent is another feature of the new module subsystem. Previously, in almost all Linux versions, modules were smart enough. They could scan the bus to find the device ID number that it identified (recognized, it detects the devices that it supports (such as PCI, ISA PnP, and PC cards ). Linux 2.6 standardizes this support to make it external to the kernel. It is easier for external programs and module loaders to determine which devices a specific module can support. This will allow various hardware management programs (such as the Redhat kudzu) to make intelligent judgments on the hardware, even if they are not familiar with the hardware devices they process. If your knowledge goes beyond the current version of the driver, you can (through an interface in the new sys File System) force a driver to work on a specific device, even if the driver does not know that it can support the device.

Other improvements

In addition to many of the above changes, there are also many other general changes that can improve the system performance. This includes more removal of "Big kernel Lock" (non-fine-grained locks used in early Linux to support SMP systems ), and Optimization for file system pre-read, write-back, and small file operations.

Linux 2.6 also solves a more profound stability problem: the kernel will not allocate more memory than the system's RAM (plus swap. Previously, in Linux, even if the system memory is used up, the malloc operation is still allowed to allocate memory successfully. The overcommitment logic is modified so that this situation is no longer possible. (Of course, if you have exhausted the system's RAM, even if you have not exceeded the maximum number of available resources-you need to worry about more serious problems .)

Linux is always a supporter of open standards. One of the major changes in the kernel is that the Linux Thread framework is overwritten so that NPTL (Native POSIX Thread Library) can run on it. This is a major performance improvement for Pentium Pro and more advanced processors that run heavily-loaded thread applications. It is also expected by many high-end systems in enterprise applications. (In fact, RedHat has transplanted it back to Linux 2.4, starting from RedHat 9.0) the change of the thread framework contains many new concepts in the LInux thread space, including thread groups, local storage areas of threads, POSIX style signals, and other changes. One of the main disadvantages is that older Linux-isms-based applications that do not comply with POSIX standards (such as Sun Java) cannot run on systems that support new threads. Given that the advantage of using the new thread model is far greater than the disadvantage, it is obvious that the most important applications will support this change shortly after the new kernel is released.

Finally, 2.6 supports disabling the kernel for storage swap (swap) during compilation, although there is no direct benefit for most applications on Linux. This allows Linux to run in a relatively small footprint (footprint), and may be useful for embedded systems that are unlikely to use swap devices.

Original text from [than the Internet], reproduced Please retain the original link: http://soft.chinabyte.com/ OS /27/12113027.shtml
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.