Comparison between Linux kernel and traditional Unix kernel

Source: Internet
Author: User
Article title: comparison between Linux kernel and traditional Unix kernel. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

All Unix kernels are of the same origin and provide the same API. modern Unix kernels have many design similarities. The Unix kernel is almost always an inseparable static executable block (file ). That is to say, they must run in a separate address space in the form of complete and separate executable blocks. Almost all Unix kernels require the hardware system to provide page mechanisms to manage memory. This page mechanism can enhance the protection of memory space and ensure that each process can run on different virtual address spaces.

Comparison between single-core and micro-core designs
The operating system kernel can be divided into two major design camps: single kernel and micro kernel (kernel outside the third camp is mainly used in scientific research systems, but it is also growing in the real world ).

A single kernel is a relatively simple design in the two camps. before 1980, all kernels were designed as single kernels. A single kernel is implemented as a separate large process and runs in a separate address space at the same time. Therefore, such a kernel is usually stored on a disk in the form of a single static binary file. All kernel services run in such a large kernel space. The communication between kernels is insignificant because everyone is running in the kernel state and in the same address space: the kernel can directly call functions, which is no different from the user space. Supporters of this model think that a single module is simple and high-performance. Most Unix systems are designed as single modules.

On the other hand, the microkernel is not implemented as a separate large process. On the contrary, the features of the microkernel are divided into independent processes, each of which is called a server. Ideally, only servers that strongly request privileged services run in privileged mode, and other servers run in user space. However, all servers remain independent and run in their respective address spaces. Therefore, it is impossible to directly call functions like a single module kernel, but to process micro-kernel communication through message transmission: The system uses the inter-process communication (IPC) mechanism. therefore, various servers exchange messages and exchange "services" through the IPC mechanism ". Each server independently and effectively avoids the failure of one server and the other.

Similarly, a modular system allows one server to be switched out for another server. Because the IPC mechanism has more overhead than function calls and involves context switching between kernel space and user space, message transmission takes a certain period, simple function calls in a single kernel do not have these overhead. Based on this, the actual microkernel system allows most or all servers to be in the kernel, so that you can directly call functions to eliminate frequent context switches. Windows NT kernel and Mach (components of Mac OS X) are typical micro-kernel instances. Both Windows NT and Mac OS X do not allow any microkernel servers to run in the user space in their latest versions, which violates the original design of the microkernel.

Linux is a single kernel, that is, the Linux kernel runs in a separate kernel address space. However, Linux has taken the essence of the micro-kernel: it is proud of its modular design, preemptible kernel, support for kernel threads, and the ability to dynamically load kernel modules. Moreover, Linux also avoids the performance loss defect in its microkernel design, so that everything runs in the kernel state and calls functions directly without passing messages. So far, Linux is a modular, multi-threaded operating system and the kernel itself can be scheduled. Pragmatism once again prevails.

When Linus and other kernel developers design the Linux kernel, they are not completely different from the Unix kernel. They fully realized that they should not ignore the Unix background (especially the Unix API ). Since Linux is not based on a specific Unix, Linus and his partners can choose the best solution known for each particular problem-sometimes, of course, some new solutions can also be created. The following is an analysis and comparison of kernel features of Linux kernel and Unix variants:
· Linux supports dynamic loading of kernel modules. Although the Linux kernel is also a single kernel, some kernel code can be dynamically detached and loaded as needed.

· Linux supports the symmetric multi-processing (SMP) mechanism. although many Unix variants also support SMP, traditional Unix does not support this mechanism.

· Preemptive ). Unlike traditional Unix, the Linux kernel has the ability to give priority to tasks running in the kernel. Among other Unix products, only Solaris and IRIX support preemption, but most traditional Unix kernels do not support preemption.

· Linux's implementation of thread support is interesting: the kernel does not distinguish threads from other general processes. For the kernel, all processes are the same-only some of them share resources.

· Linux provides device-Class object-oriented device models, hot swapping events, and user space device file systems (sysfs ).

· Linux ignores some Unix features that are considered poorly designed, such as STREAMS, and ignores outdated standards that are not actually used at all.

· Linux represents the essence of freedom. The existing Linux feature set is the result of the free development of the Linux public development model. If a feature has no value or has poor creativity, no one will be forced to implement it. On the contrary, during the development of Linux, a commendable pragmatic attitude has been formed: any change must be aimed at problems in reality, it has been well designed and implemented correctly and concisely. As a result, many other features of modern Unix systems, such as the kernel paging mechanism, are introduced without hesitation.

Regardless of the differences between Linux and Unix, it is deeply labeled as Unix.

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.