gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:25:47 34 4
gpt4 key购买 nike

我正在阅读“了解 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/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com