经典书籍翻译——深入理解Linux内核23

Kernel Architecture
As stated before, most Unix kernels are monolithic: each kernel layer is integrated into the whole kernel program and runs in Kernel Mode on behalf of the current process. In contrast, microkernel operating systems demand a very small set of functions from the kernel, generally including a few synchronization primitives, a simple scheduler, and an interprocess communication mechanism. Several system processes that run on top of the microkernel implement other operating system–layer functions, like memory allocators, device drivers, and system call handlers.
Although academic research on operating systems is oriented toward microkernels, such operating systems are generally slower than monolithic ones, because the explicit message passing between the different layers of the operating system has a cost. However, microkernel operating systems might have some theoretical advantages over monolithic ones. Microkernels force the system programmers to adopt a modularized approach, because each operating system layer is a relatively independent program that must interact with the other layers through well-defined and clean software interfaces. Moreover, an existing microkernel operating system can be easily ported to other architectures fairly easily, because all hardware-dependent components are generally encapsulated in the microkernel code. Finally, microkernel operating systems tend to make better use of random access memory (RAM) than monolithic ones, because system processes that aren’t implementing needed functionalities might be swapped out or destroyed.

内核架构
如前所述,大多数Unix内核是宏模式:每个内核层集成到整个内核程序中并且以内核态运行当前进程。相反的,微内核操作系统需要内核中很少的函数集,通常包括一些同步元语,一个普通的调度器和一个进程间通信机制。有些运行在微内核之上的系统进程实现了其他的操作系统层的功能,比如内存分配、设备驱动以及系统调用处理程序。
尽管建立在操作系统之上的学术研究是面向微内核的,这样的操作系统通常比宏内核的运行速度较慢——因为不同操作系统层之间民缺的消息传递产生了额外的消耗,但是微内核操作系统比宏内核操作系统可能具有理论上的优势。微内核迫使系统程序员采用模块化的方式,因为每个操作系统层都是一个相对独立的程序,必须通过定义良好且干净的软件接口来实现不同层次之间的交互。此外,现有的微内核操作系统可以非常容易地移植到其他架构中,因为所有独立于硬件的部件通常都被封装在微内核代码中。最后,微内核操作系统比宏内核操作系统更能发挥RAM的优势,因为没有实现必须功能的系统进程有可能被替换或者废弃。

猜你喜欢

转载自blog.csdn.net/m0_37546257/article/details/121456704