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

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

问题描述

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

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

80 x中已包含细分 86个微处理器鼓励 程序员拆分他们的 应用程序在逻辑上相关 实体,例如子程序或 全球和本地数据区域.然而, 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 using使用后者-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中的分段:分段和分页是否多余?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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