Detailed analysis of Linux operating system source code (3)

Source: Internet
Author: User
Detailed analysis of Linux operating system source code (3)-Linux general technology-Linux programming and kernel information. The following is a detailed description. Chapter 4 kernel Architecture Overview

This chapter describes the kernel at a higher level. In terms of sequence, this chapter first introduces the kernel design objectives, then introduces the kernel architecture, and finally introduces the kernel source program directory structure.

   3.1 kernel design goals

The Linux kernel shows several interrelated design goals: clarity, compatibility, portability, robustness, security, and speed. These goals are sometimes complementary and sometimes contradictory. However, they are kept in a consistent state as much as possible, and the features of kernel design and implementation usually return to these problems. The subsequent sections in this section will discuss these design objectives and briefly describe the trade-offs and balances between them.

   3.1.1 clarity

To simplify it, the kernel aims to be as clear as possible while ensuring speed and robustness. This is different from the development of most applications. The latter usually aims to increase the speed as much as possible on the basis of clarity and robustness. Therefore, in the kernel, speed and clarity are often a conflict.

To some extent, clarity is a necessary supplement to Robustness: An easy-to-understand implementation method can easily prove to be correct; or, even if not, the problem can also be easily identified. As a result, these two goals rarely conflict.

However, clarity and speed are usually in conflict. The algorithms that have been carefully optimized usually use similar technologies used by the compiler to generate code, and are rarely the clearest solution. When the clarity and speed requirements in the kernel are inconsistent, the speed is usually guaranteed at the expense of clarity. Even so, programmers still clearly understand the importance of clarity, and they have done a lot of work to use the clearest way to ensure speed.

   3.1.2 compatibility

As described in Chapter 1st, Linux was originally written to implement a complete, Unix-compatible operating system kernel. As the development process expands, it also begins to meet the POSIX standard. As far as the kernel is concerned, there is no difference between Unix compatibility (at least compatible with a modern Unix implementation) and POSIX compliance, so we will not look into this issue in detail.

The kernel provides another type of compatibility. The Linux-based system can provide optional local running support for Java. class files (it is said that Linux is the first operating system to provide such support ). Although the Java program is actually responsible for interpreting and executing another Java Virtual Machine Process, the virtual machine is not built into the kernel. However, this mechanism provided by the kernel makes this support transparent to users. The degree of support provided by the kernel itself is different (this does not mean that most of the work can be implemented through external processes like the Java solution ), support for other executable file formats can also be inserted into the kernel in the same way. This will be detailed in chapter 7th.

In addition, the GNU/Linux system, as a whole, provides support for DOS executable programs through the DOSEMU simulation machine, in addition, some Windows executable programs are supported through the WINE design. The system also supports Windows-compatible file and print services in the same way through SAMBA. However, these issues are not closely related to the kernel, so we will not discuss them in this book.

Another aspect of compatibility is compatibility with heterogeneous file systems. This chapter will provide more details later, but most of the content is beyond the scope of this book. Linux supports many file systems, such as ext2 (local file system), ISO-9660 (file system used by CD-ROM), MS-DOS, Network File System (NFS) and many other file systems. If you have a disk or Network Disk server in another operating system format, Linux can interact with these different file systems.

Another problem of compatibility is the network, which is particularly important in today's Internet era. As a Unix variant, Linux has provided support for TCP/IP since very early on. The kernel also supports many other network protocols, including the code of the AppleTalk protocol, which allows Linux units to communicate freely with Macintosh machines. The Novell network protocol, that is, the Network Packet Exchange (IPX ), group message Exchange (SPX) and NetWare Core Protocol (NCP); new version of IP protocol IPv6 and some other less famous protocols.

The last aspect of compatibility is hardware compatibility. It seems that every uncommon graphics card, small-market Nic, non-standard CD-ROM interface, and dedicated tape device has a Linux Driver (as long as it is not dedicated hardware designed for a particular operating system). As long as more and more vendors gradually recognize the advantages of Linux and open source code for easier implementation of porting to Linux, Linux will provide better hardware support.

These compatibility must be achieved through an important sub-goal: module degree. If possible, the kernel only defines the abstract interface of the subsystem, which can be implemented in any way. For example, the kernel's support for the new file system is simplified to the code implementation for the Virtual File System (VFS) interface. In Chapter 7th, we will introduce another example. The kernel's abstract support for Binary handles is a way to support new executable formats such as Java. The support for new executable formats will be transformed into the implementation of the corresponding binary handle interface.
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.