Linux 中的分段 : Segmentation &分页是多余的吗? [英] Segmentation in Linux : Segmentation & Paging are redundant?

查看:14
本文介绍了Linux 中的分段 : Segmentation &分页是多余的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm reading "Understanding Linux Kernel". This is the snippet that explains how Linux uses Segmentation which I didn't understand.

分割已包含在 80 x86个微处理器鼓励程序员将他们的应用到逻辑相关实体,例如子程序或全局和本地数据区.然而,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.

Linux 的设计目标之一可移植到范围广泛的架构;RISC 架构特别支持有限细分.

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

在用户中运行的所有 Linux 进程模式使用同一对段来地址指令和数据.这些段称为用户代码段和用户数据段,分别.同样,所有运行的 Linux 进程在内核模式下使用相同的一对段来寻址指令和数据:它们被称为内核代码段和内核数据段,分别.表 2-3 显示了段描述符的值这四个关键领域段.

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.

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

I'm unable to understand 1st and last paragraph.

推荐答案

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

The 80x86 family of CPUs generate a real address by adding the contents of a CPU register called a segment register to that of the program counter. Thus by changing the segment register contents you can change the physical addresses that the program accesses. Paging does something similar by mapping the same virtual address to different real addresses. Linux using uses the latter - the segment registers for Linux processes will always have the same unchanging contents.

这篇关于Linux 中的分段 : Segmentation &分页是多余的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆