Features and structure of Linux kernel

Source: Internet
Author: User
Linux Kernel features and structure-general Linux technology-Linux programming and kernel information. The following is a detailed description. Linux Kernel features
Linux is a modern operating system with strong practicability. The backbone of its development is software engineers. Therefore, it is based on practicality and efficiency. Many factors such as industrial specifications and compatibility are also taken into account, therefore, unlike the educational operating system's pursuit of the most advanced theory, the Linux kernel focuses on practicality and efficiency.

Next we will briefly summarize the features of the Linux kernel.

First, the Linux kernel is designed as a single giant kernel (monolithic ?) Structure (compared with the micro-kernel, the micro-kernel is a core software with more functions close to the hardware, it generally only includes primary memory management, synchronization primitives, inter-process communication mechanisms, I/O operations, and interrupt management. This is conducive to scalability and portability. However, the microkernel and other upper-layer modules such as file management, device drivers, virtual memory management, and process management require high communication overhead. Therefore, they are mostly concentrated in the field of theoretical teaching, it is difficult to guarantee the efficiency of industrial applications .), Therefore, it is highly efficient and compact.

Second, before version 2.6, the Linux kernel is a single-threaded structure. The so-called thread structure means that only one execution thread (the execution program in the kernel) can be run in the kernel at the same time, it will not be interrupted by the scheduler to run other tasks. This kernel is not preemptible, and its advantage is that there are no concurrent tasks in the kernel (for single processor ), therefore, many complex synchronization problems are avoided, but the adverse effect is that the non-preemption feature delays the system response speed. New tasks must wait until the current task is executed and exited in the kernel to obtain the running opportunity. In the industrial control field, high response speed is required. As a result of the contribution of Robert love and others after version 2.6, the preemption technology is introduced into the Linux kernel, making it a kernel preemption system, of course, the price is that the synchronization operation is further complicated.

Third, in order to ensure convenient support for new devices and new functions, and without infinitely expanding the kernel size, the Linux system uses modular methods for device drivers or new file systems, the user can dynamically load on site when needed, and can dynamically unload after use. At the same time, you can also customize the kernel and select the appropriate features to remove unnecessary parts from the kernel. Both technologies ensure the kernel's closeness and scalability.

Fourth, the Linux kernel is purely a passive calling service object. The so-called passive means that the only way it serves users is to request a function to run in the kernel space through system calls. The kernel itself is a collection of functions and data structures, and there is no running kernel process serving users (although Linux does have a process called a kernel thread, but it is not used to serve users, but only serves the purpose of the system itself ).

Fifth, the use of virtual memory technology in the Linux Kernel enables the virtual expansion of memory space to as much as 4 GB. Among them, 0-3G belongs to the user space, which is called the user segment, and 3g-4g belongs to the user space and is called the kernel segment. This allows users to write programs to use a much larger storage space than the actual memory.

Sixth, the biggest feature of Linux's file system is the implementation of an abstract file model-VFS (Virtual File System), which belongs to the Unix style. The Virtual File System shields the internal differences between different file systems, allowing users to access different file systems in the same way, you can use the unified interface provided by VFS to exchange data between file systems of different media formats. This abstraction brings infinite vitality to Linux.

7. Linux provides a very effective latency execution mechanism-lower half, Soft Interrupt, tasklet, and 2.6 newly introduced job queues. These technologies ensure that the system can prioritize tasks, select the execution time in finer granularity. This ensures that the system runs at a safe time (without interruption ).

In addition to the features mentioned above, Linux also has many other outstanding features, which will be introduced in an orderly manner in subsequent sections. If you have any questions about the above features, please do not worry, and you will be able to answer your questions later.

Linux operating system kernel structure
Although the implementation of the Linux kernel is quite different from that of the Unix system, the structure of the Linux kernel is basically the same as that of the Unix system, and the functions are basically the same as the kernel requirements of the operating system we mentioned earlier.

If any program in the user space needs to use the services provided by the kernel, it must be called by the system. Therefore, most modules in the System Call layer and kernel have interfaces, they are also used to control system service properties (such as sys_fnctl setting file operation properties; sys_nice setting process time slices), or to extract data from the kernel (such as sys_time obtaining system timing maintained by time interruptions ), or request the kernel to allocate resources (brk extends the process heap memory ).

The file system includes VFS and various actual file systems. VFS abstracts unified interfaces for the actual file system, while the actual file system provides its own specific instance operation methods. In addition, Linux and Unix devices are cleverly attributed to special files and are abstracted and managed by the file system. Therefore, the operation method is the same as that of the file system. The file system submits operations on the device to the actual device driver for processing.

In Linux, device management divides devices into Block devices, such as disks and character devices, which can only be accessed sequentially, such as keyboards. The character device structure is simple, and the file system can directly submit requests to the character device driver for processing. However, for Block devices, frequent random access requires repeated disk addressing operations, this will impose a heavy burden on the system's core load. Therefore, the kernel must integrate requests from Block devices, such as queuing, merging, and selectively distributing requests to physical devices; in addition, you also need to buffer disk blocks in the memory when reading the device. Therefore, requests must be pre-processed by the I/O layer before they are submitted to block devices. After a disk block is read, the I/O layer must perform block buffering.

The interrupt management system is responsible for the service of the device. It saves the CPU cycle compared to polling and other methods. In addition, the clock interruption is also responsible for updating the system time and triggering process scheduling.

Memory is one of the core resources in the system and is essential for data storage and transmission. Therefore, the management system must be used not only for system calls, in addition, almost all modules in the system need to use functions of the memory management system. Memory needs to be allocated for file systems and I/O systems to buffer data. process data storage and address shadow in process management require memory, and heap growth also requires dynamic request memory; another effective method in process communication is to use shared memory.

In addition to memory management and process communication, process management is also associated with file systems, because files in Process resources are undoubtedly one of the most important parts, therefore, the process management system must also interact with the file system.

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.