operating-system - Linux 中的分段 : Segmentation & Paging are redundant?

标签 operating-system linux-kernel paging

我正在阅读“了解 Linux 内核”。这是解释 Linux 如何使用我不理解的分段的片段。

Segmentation has been included in 80 x 86 microprocessors to encourage programmers to split their applications into logically related entities, such as subroutines or global and local data areas. However, Linux uses segmentation in a very limited way. In fact, segmentation and paging are somewhat redundant, because both can be used to separate the physical address spaces of processes: segmentation can assign a different linear address space to each process, while paging can map the same linear address space into different physical address spaces. Linux prefers paging to segmentation for the following reasons:

Memory management is simpler when all processes use the same segment register values that is, when they share the same set of linear addresses.

One of the design objectives of Linux is portability to a wide range of architectures; RISC architectures in particular have limited support for segmentation.

All Linux processes running in User Mode use the same pair of segments to address instructions and data. These segments are called user code segment and user data segment , respectively. Similarly, all Linux processes running in Kernel Mode use the same pair of segments to address instructions and data: they are called kernel code segment and kernel data segment , respectively. Table 2-3 shows the values of the Segment Descriptor fields for these four crucial segments.

我无法理解第一段和最后一段。

最佳答案

80x86 系列 CPU 通过将称为段寄存器的 CPU 寄存器的内容与程序计数器的内容相加来生成真实地址。因此,通过更改段寄存器的内容,您可以更改程序访问的物理地址。分页通过将相同的虚拟地址映射到不同的真实地址来完成类似的事情。 Linux using 使用后者 - Linux 进程的段寄存器将始终具有相同的不变内容。

关于operating-system - Linux 中的分段 : Segmentation & Paging are redundant?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35377687/

相关文章:

ios - 如何通过 panGestureRecognizer 启用 collectionView 分页

mysql - 排序表的分页

Hibernate:页面结果并知道结果大小

c++ - 编译后的程序如何与操作系统交互?

linux-kernel - 从fork()到do_fork()的函数调用

c - Linux INIT_LIST_HEAD 首先,

c - 获取 kobject_add 的父级

operating-system - 什么是梯形调节器和菜单调节器?

javascript - 通过javascript获取特定的Windows版本

linux - 在操作系统中,为什么可加载内核模块(LKM)不需要调用消息传递来进行通信?