Linux Kernel and Kernel Programming Part 2 Kernel Features After Linux 2.6

3.2 Kernel features after Linux 2.6

    Compared with Linux 2.4, Linux 2.6 has considerable improvements, which are mainly reflected in the following aspects.

    1. New scheduler

    Linux kernels since Linux 2.6 use a new process scheduling algorithm, which has extremely good performance under high load and scales well when there are many processors. The O(1) algorithm was adopted in the early days of Linux kernel 2.6 , and then moved to the CFS (Completely Fair Scheduler) algorithm. In Linux 3.14, a new scheduling class has also been added: SCHED_DEADLINE, which implements the EDF (Earliest Deadline First, the earliest deadline first) scheduling algorithm.

2. Kernel preemption

    In Linux kernels later than Linux 2.6, a kernel task can be preempted to improve the real-time performance of the system. The main advantage of doing this is that it can greatly enhance the user interactivity of the system, and users will feel that mouse clicks and keystrokes are responded more quickly. Kernel versions after Linux 2.6 still have some non-preemptable intervals, such as interrupt context, soft interrupt context, and spinlock-locked intervals. If the Linux kernel is patched with RT-Preempt, both interrupts and soft interrupts will be threaded. , spinlocks were also replaced by mutexes, and the Linux kernel became hard real-time.

    In the kernels after Linux 2.6, there are still situations in which atomic context processes such as interrupts, soft interrupts, and spin locks cannot be preempted for execution. This is the reason why the Linux kernel itself only provides soft real-time capabilities.

3. Improved threading model

    Threads in Linux 2.6 and later versions use the NPTL (Native POSIX Thread Library, native POSIX thread library) model, which greatly improves the operation speed. Compared with the LinuxThreads model in the Linux 2.4 kernel era, it also more closely follows the requirements of the POSIX specification. NPTL does not use the management threads used in the LinuxThreads model, and the kernel itself also adds FUTEX ( Fast Userspace Mutex, fast user-mode mutex ), thereby reducing the communication overhead of multi-threading.

4. Changes in virtual memory

    From the perspective of virtual memory, the new kernel incorporates r-map (reverse mapping) technology, which significantly improves the performance of virtual memory under certain loads. In Linux 2.4, when a page is to be reclaimed, the kernel's practice is to traverse all the PTEs (page table entries) of each process to determine whether the PTE has been mapped with the page, if so, cancel the mapping, and finally there is no PTE The page is not recycled until it is associated with the page. After Linux 2.6, the reverse mapping is established, and the mapping to the page can be quickly found through the page structure.

5. File system

    The Linux 2.6 version of the kernel adds support for the journaling file system function, which solves the shortcomings of the Linux 2.4 version in this regard. Key changes to the file system in the Linux 2.6 kernel also include support for extended attributes and POSIX standard access control. ext2/ext3/ext4 are the default file systems installed in most Linux systems. In the Linux version 2.6 kernel, support for extended attributes has been added, and metadata can be embedded in the file system for specified files.

    In terms of file system, the current research hotspot is Btrfs based on B-tree. Btrfs is called the next-generation Linux file system. It is superior to ext4 in terms of scalability, data consistency, multi-device management and optimization for SSD.

6. Audio

    The Advanced Linux Sound Architecture (ALSA) replaces the old OSS (Open Sound System) with many flaws. ALSA supports USB audio and MIDI (Music Device Digital Interface) devices, and supports features such as full-duplex playback.

7. Bus, device and driver models

    In the kernel after Linux 2.6, the control of the device is realized due to a certain connection between the bus, the device and the driver. The bus is the basis for the connection of the three, and connects the device and the driver through a bus type. The match() function in the bus type is used to match the device and the driver. When the matching operation is completed, the probe() function in the driver is executed.

8. Power Management

    Support advanced configuration and power interface (Advanced Configuration and Power Interface, ACPI), used to adjust the CPU to work at different clock frequencies under different loads to reduce power consumption. At present, the power management (PM) of the Linux kernel is relatively complete, including a full set of support such as CPUFreq, CPUIdle, CPU hot-plug, device runtime (runtime) PM, Linux system suspend to memory and suspend to hard disk, etc. The support on ARM is also more complete.

9. Networking and IPSec

    The Linux 2.6 kernel added support for IPSec, removed the original built-in HTTP server khttpd in the kernel, added support for the new NFSv4 (Network File System) client/server, and improved support for IPv6.

10. User Interface Layer

    The Linux 2.6 kernel rewrote the framebuffer/console layer, and the human interface layer added support for nearly all interface devices (from touchscreens to devices for the blind and various kinds of mice).

    In terms of device drivers, Linux 2.6 also has major changes compared to Linux 2.4, which are mainly reflected in the addition of many new functions (such as memory pools) to the kernel API, the sysfs file system, and the change of kernel modules from .o to .ko. , Drive module compilation method, module usage count, definition of module loading and unloading functions, etc.

11. Changes in ARM architecture after Linux 3.0

    Linus Torvalds declared "this whole ARM thing is af*cking pain in the ass" on the ARM Linux mailing list on March 17, 2011, which caused an earthquake in the ARM Linux community, followed by a series of major corrections in the ARM community. The community must change this situation, so FDT (Flattened Device Tree), which has been used under other architectures such as PowerPC, has entered the field of view of the ARM community.
    In addition, the code of ARM Linux has been optimized and adjusted in many aspects such as clock, DMA, pinmux, timer scale, etc., and the arch/arm/mach-xxx/include/mach header file directory has also been deleted, so that after Linux 3.7 The kernel can support multiple platforms, that is, use the same kernel image to run on multiple chips of multiple SoC companies, realizing "one Linux can be applied to all ARM systems".





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325997191&siteId=291194637